That is why you get a substantial deposit when you accept an offer.
If they bail, you keep their deposit in respect for your time and effort.
I've been on both end of deals like this. Accepted an offer to sell a home one time, got the deposit and the dude bailed, so we kept the deposit which was cool, because I sold the place shortly thereafter. Also put $5,000 down on a farm and was fixing to purchase it when my neighbor approached me wanting to sell his ground. I couldn't do both and it would have been silly to pass up purchasing a piece of adjoining ground, so I called the realtor, apologized and told them to cash & keep my deposit check.