How would you protect yourself?

Let's say you're in this situation.

You borrowed money from bank/investor to build apartments. Apartments are being built, but no sales yet. Your trying your best to get the loan paid, but no sales yet.

Worst case scenario you discover there isn't a market for those types of apartments, or the market is too small, so you wouldn’t be able to sell enough apartments to pay off the loan in time.

You worked you ass off to get to the point where the apartments are being built. How would you…

How would you protect yourself? ^(