diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtBinaryExpression.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtBinaryExpression.java index 6e5571fb9dd..88c228ccea7 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtBinaryExpression.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtBinaryExpression.java @@ -23,6 +23,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.KtNodeTypes; +import java.util.Arrays; + public class KtBinaryExpression extends KtExpressionImpl implements KtOperationExpression { public KtBinaryExpression(@NotNull ASTNode node) { super(node); @@ -64,7 +66,12 @@ public class KtBinaryExpression extends KtExpressionImpl implements KtOperationE @Override @NotNull public KtOperationReferenceExpression getOperationReference() { - return (KtOperationReferenceExpression) findChildByType(KtNodeTypes.OPERATION_REFERENCE); + PsiElement operationReference = findChildByType(KtNodeTypes.OPERATION_REFERENCE); + if (operationReference == null) { + throw new NullPointerException("No operation reference for binary expression: " + Arrays.toString(getChildren())); + } + + return (KtOperationReferenceExpression) operationReference; } @NotNull @@ -72,3 +79,4 @@ public class KtBinaryExpression extends KtExpressionImpl implements KtOperationE return getOperationReference().getReferencedNameElementType(); } } +