Ticket #5073: Don't crash upon invalid do-while loop.

Hi,

This patch fixes ticket #5073 by not asserting upon an invalid do-while loop but rather bailing out. Thanks to consider merging.

Best regards,
  Simon