If you're falling backwards just let it happen but make sure you let go of the bar with your hands.
If you're stuck at the bottom and just can't get it up, you have to push the bar off your shoulders and jump back at the same time straightening your legs. The bar should land over your knees or shins and as long as it's the correct height, it should safely roll over them without touching them.
Also, if you don't have a platform where dumping the weights is an option, you can always set the pins on a power rack an inch or two below your squatting depth and dump the bar if you get stuck.
Hope this helped