From c3fd2df7d2a9f53cdda37ed4aed1556ff0543a2a Mon Sep 17 00:00:00 2001 From: Jura Stakhiv Date: Mon, 30 Jan 2017 18:34:51 +0200 Subject: [PATCH] Do not run lexer.Consumed if there's an error. --- jlexer/lexer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jlexer/lexer.go b/jlexer/lexer.go index fc0af92..9a83763 100644 --- a/jlexer/lexer.go +++ b/jlexer/lexer.go @@ -589,7 +589,7 @@ func (r *Lexer) IsStart() bool { // Consumed reads all remaining bytes from the input, publishing an error if // there is anything but whitespace remaining. func (r *Lexer) Consumed() { - if r.pos > len(r.Data) { + if r.pos > len(r.Data) || !r.Ok() { return }