Skip to content

Commit

Permalink
Check the predicate of HasContainer can't be null
Browse files Browse the repository at this point in the history
fix #15

Change-Id: I2faf8bf5182987e77a946a2809cd050f69e1cef1
  • Loading branch information
javeme committed Aug 18, 2018
1 parent 16fd728 commit faaf8ba
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ public static ConditionQuery fillConditionQuery(
public static Condition convHas2Condition(HasContainer has,
HugeType type,
HugeGraph graph) {
BiPredicate<?, ?> bp = has.getPredicate().getBiPredicate();
P<?> p = has.getPredicate();
E.checkArgument(p != null, "The predicate of has(%s) is null", has);
BiPredicate<?, ?> bp = p.getBiPredicate();
Condition condition;
if (keyForContainsKeyOrValue(has.getKey())) {
condition = convContains2Relation(graph, has);
Expand All @@ -198,13 +200,13 @@ public static Condition convHas2Condition(HasContainer has,
condition = convRelationType2Relation(graph, type, has);
} else if (bp instanceof Contains) {
condition = convIn2Relation(graph, has);
} else if (has.getPredicate() instanceof AndP) {
} else if (p instanceof AndP) {
condition = convAnd(graph, type, has);
} else if (has.getPredicate() instanceof OrP) {
} else if (p instanceof OrP) {
condition = convOr(graph, type, has);
} else {
// TODO: deal with other Predicate
throw newUnsupportedPredicate(has.getPredicate());
throw newUnsupportedPredicate(p);
}
return condition;
}
Expand Down

0 comments on commit faaf8ba

Please sign in to comment.