Check for corrupted error locations when showing a message.

Check for corrupted error locations when showing a message.

Example code causing the issue:
```
for a in [1,2,3]
# unindented comment
  yes
```