EA-59392 (NPE: ControlFlowAnalyzer.visitPostfixExpression)

This commit is contained in:
Bas Leijdekkers
2014-08-14 22:38:21 +02:00
parent b6d14a7514
commit e65ecdae08
2 changed files with 10 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1505,12 +1505,14 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
IElementType op = expression.getOperationTokenType();
PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand());
operand.accept(this);
if (op == JavaTokenType.PLUSPLUS || op == JavaTokenType.MINUSMINUS) {
if (operand instanceof PsiReferenceExpression) {
PsiVariable variable = getUsedVariable((PsiReferenceExpression)operand);
if (variable != null) {
generateWriteInstruction(variable);
if (operand != null) {
operand.accept(this);
if (op == JavaTokenType.PLUSPLUS || op == JavaTokenType.MINUSMINUS) {
if (operand instanceof PsiReferenceExpression) {
PsiVariable variable = getUsedVariable((PsiReferenceExpression)operand);
if (variable != null) {
generateWriteInstruction(variable);
}
}
}
}

View File

@@ -90,5 +90,6 @@ class T1 {
++(<error descr="Variable 'i2' might not have been initialized">i2</error>);
<error descr="Variable 'i3' might not have been initialized">i3</error> += 1;
(i4) = 1;
(<error descr="Expression expected">)</error>++;
}
}