Fix NPE revealed by updated testing method
This commit is contained in:
parent
805430177c
commit
7235d71cc0
|
@ -527,7 +527,7 @@ public class Tool {
|
||||||
/** Manually get option node from tree; return null if no defined. */
|
/** Manually get option node from tree; return null if no defined. */
|
||||||
public static GrammarAST findOptionValueAST(GrammarRootAST root, String option) {
|
public static GrammarAST findOptionValueAST(GrammarRootAST root, String option) {
|
||||||
GrammarAST options = (GrammarAST)root.getFirstChildWithType(ANTLRParser.OPTIONS);
|
GrammarAST options = (GrammarAST)root.getFirstChildWithType(ANTLRParser.OPTIONS);
|
||||||
if ( options!=null ) {
|
if ( options!=null && options.getChildCount() > 0 ) {
|
||||||
for (Object o : options.getChildren()) {
|
for (Object o : options.getChildren()) {
|
||||||
GrammarAST c = (GrammarAST)o;
|
GrammarAST c = (GrammarAST)o;
|
||||||
if ( c.getType() == ANTLRParser.ASSIGN &&
|
if ( c.getType() == ANTLRParser.ASSIGN &&
|
||||||
|
|
Loading…
Reference in New Issue