From 6d47fd2823e28e29765e85920d6a25a322393cad Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Tue, 11 Jan 2022 17:54:03 +0800 Subject: [PATCH] fix: core test --- .../com/baidu/hugegraph/traversal/optimize/TraversalUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java index e9d9c49c54..c09b5cdb6b 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java @@ -30,6 +30,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.google.common.collect.Collections2; import org.apache.tinkerpop.gremlin.process.traversal.Compare; import org.apache.tinkerpop.gremlin.process.traversal.Contains; import org.apache.tinkerpop.gremlin.process.traversal.Order; @@ -571,6 +572,9 @@ public static void convAllHasSteps(Traversal.Admin traversal) { List steps = TraversalHelper.getStepsOfAssignableClassRecursively( HasStep.class, traversal); + if (steps.isEmpty() || !traversal.getGraph().isPresent()) { + return; + } HugeGraph graph = (HugeGraph) traversal.getGraph().get(); for (HasStep step : steps) { TraversalUtil.convHasStep(graph, step);