forked from jasder/antlr
add null check to findNodeSuchThat
This commit is contained in:
parent
9519bfc36f
commit
5616e370e4
|
@ -249,6 +249,8 @@ public class Trees {
|
|||
public static Tree findNodeSuchThat(Tree t, Predicate<Tree> pred) {
|
||||
if ( pred.test(t) ) return t;
|
||||
|
||||
if ( t==null ) return null;
|
||||
|
||||
int n = t.getChildCount();
|
||||
for (int i = 0 ; i < n ; i++){
|
||||
Tree u = findNodeSuchThat(t.getChild(i), pred);
|
||||
|
|
Loading…
Reference in New Issue