Fix infinite loop on null messages.