Assuming that you were on the mortgage, it is legal. Your ex-husband's bankruptcy affect his debts, but it does not affect your debts or obligations, especially as you are divorced. If the mortgage is not paid, the lender or mortgage company may proceed against anyone who is on the mortgage. The bankruptcy of one debtor does protect other debtors.