Ticket #5214: Don't read out of bounds upon invalid ternary operator.
Merge pull request #202 from simartin/ticket_5214

Ticket #5214: Added test case (ticket already fixed in mainline).