Add a diode on the output. Then if 24+ and zero are connected no currenent will flow. The voltage will drop one diode, but I bet it will not be noticed.