Fix npe on traversal of graph
@@ -7,6 +7,7 @@ import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.db.record.ridbag.ORidBag;
import com.orientechnologies.orient.core.exception.OCommandExecutionException;
import com.orientechnologies.orient.core.id.ORID;
+import com.orientechnologies.orient.core.record.OVertex;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.record.impl.OEdgeToVertexIterable;
import com.orientechnologies.orient.core.record.impl.OEdgeToVertexIterator;
@@ -14,6 +15,7 @@ import com.orientechnologies.orient.core.sql.executor.AggregationContext;
import com.orientechnologies.orient.core.sql.executor.OInternalResultSet;
import com.orientechnologies.orient.core.sql.executor.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultInternal;
+
import java.util.*;
import java.util.stream.Collectors;
@@ -124,7 +126,10 @@ public class OProjectionItem extends SimpleNode {
if (value instanceof OEdgeToVertexIterator) {
List<ORID> result = new ArrayList<>();
while (((OEdgeToVertexIterator) value).hasNext()) {
- result.add(((OEdgeToVertexIterator) value).next().getIdentity());
+ OVertex v = ((OEdgeToVertexIterator) value).next();
+ if (v != null) {
+ result.add(v.getIdentity());
+ }
}
return result;
}
