Fix IndexError when ParsingError happens at end of input