The regulators have put in place strong measures to ensure the safety of both your holdings and funds if your stockbroker defaults.
Holdings
In India, you can hold securities electronically in one of two depositories - CDSL or NSDL . Your stockbroker indirectly maintains the securities as a depository participant (i.e. a member of CDSL or NSDL). If your stockbroker defaults, since the securities are kept safely with the depository, you will be able to transfer your holdings to another stockbroker of your choice.
Funds
Funds, on the other hand, are held directly by the stockbrokers on behalf of their clients. SEBI requires stockbrokers to hold the client funds in a separate client pool account. The stockbroker can only use these funds for investments and trades made by their clients.
Like DICGC guarantees the safety of your bank deposits, if your bank defaults, the safety of your funds lying with your stockbroker is guaranteed by the Investor Protection Fund (up to Rs. 25 lacs).
If your stockbroker defaults, you can file a claim for your compensation anytime within three years. You can refer to this circular from SEBI that details the eligibility criteria for such claims.