Fix infinite loops on null text