The solution to preventing injury from a failed surface air supply while diving is simple but it costs money — carry an accessory emergency air source and regulator. The money so spent on this life saver may well be your best investment ever!
A suitable emergency air source converts a panic ascent into a leisurely trip to the surface. Compared to the overall cost of the diving, boat and other equipment, the cost is relatively small.
Please ensure your accessory air source has a scuba cylinder of the appropriate size for the maximum depth you're diving to. You should plan to have enough air for around 15 minutes of breathing on the ascent with a decompression stop if necessary. Smaller all-in-one air regulators generally do not contain enough gas for a controlled ascent, although they are definitely far better than no spare air at all.
The Scuba Doctor recommends a triple-redundant air supply system should be used while hookah diving. The primary air supply is a low pressure (LP) hookah compressor. The secondary is the diver carried bailout or emergency air system. Finally, in an emergency requiring additional time for diver extraction, there should be a scuba cylinder topside, suitably configured so that it can be used to provide air to the hookah diver.
Please read Introduction to Hookah Diving for more information about things you need to consider with a hookah diving setup.