avoid crashing when trying to parse invalid files, patch by Andreas Oman, andreas...