diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java index b46ea09b8f..301eafd662 100644 --- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java +++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java @@ -116,12 +116,12 @@ public final void visitToken(final DetailAST detailAST) DetailAST currentNode = detailAST; // look for EXPR which is always around BOR/BAND... operators - while (currentNode.getType() != TokenTypes.EXPR) + while (currentNode != null && currentNode.getType() != TokenTypes.EXPR) { currentNode = currentNode.getParent(); } - if (isBooleanExpression(currentNode)) { + if (currentNode != null && isBooleanExpression(currentNode)) { log(detailAST, MSG_KEY, detailAST.getText()); }