diff --git a/runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java b/runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java index 5ba99cf06..91bb1f661 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java +++ b/runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java @@ -297,7 +297,7 @@ public class DefaultErrorStrategy implements ANTLRErrorStrategy { { TokenStream tokens = recognizer.getInputStream(); String input; - if (tokens instanceof TokenStream) { + if ( tokens!=null ) { if ( e.getStartToken().getType()==Token.EOF ) input = ""; else input = tokens.getText(e.getStartToken(), e.getOffendingToken()); }