I believe it actually did happen once, and another registrar purchased their customer base. Several things could happen.
1. Assets including customer base purchased by another registrar.
2. ICANN assigns the customer database to one or more registrars.
3. Registry is run by the bankrupt company or a management company until financed are put back in order and the company returns from bankruptcy.
Probably the largest danger isn't what happens to your names, but what would happen to any positive cash balance you might have in your account with the registrar. Cash balances could make you a creditor and subject to any bankruptcy settlement.