fix NPE on MATCH execution
@@ -2,6 +2,7 @@ package com.orientechnologies.orient.core.sql.executor;
import com.orientechnologies.orient.core.command.OCommandContext;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
+import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.sql.parser.OInteger;
import com.orientechnologies.orient.core.sql.parser.OTraverseProjectionItem;
import com.orientechnologies.orient.core.sql.parser.OWhereClause;
@@ -24,8 +25,8 @@ public class BreadthFirstTraverseStep extends AbstractTraverseStep {
while (nextN.hasNext()) {
while (nextN.hasNext()) {
OResult item = toTraverseResult(nextN.next());
-
- ArrayDeque stack = new ArrayDeque();
+ if(item != null){
+ ArrayDeque<ORID> stack = new ArrayDeque<ORID>();
item.getIdentity().ifPresent(x -> stack.push(x));
((OResultInternal) item).setMetadata("$stack", stack);
@@ -39,6 +40,7 @@ public class BreadthFirstTraverseStep extends AbstractTraverseStep {
}
}
+ }
nextN = getPrev().get().syncPull(ctx, nRecords);
}
}
