add nullptr check

This commit is contained in:
Terence Parr 2015-01-12 12:58:50 -08:00
parent 7b06987335
commit c9a51b98ae
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ public class GrammarAST extends CommonTree {
}
public GrammarAST getNodeWithTokenIndex(int index) {
if ( this.getToken().getTokenIndex()==index ) {
if ( this.getToken()!=null && this.getToken().getTokenIndex()==index ) {
return this;
}
// walk all children of root.