From cd587a02172e6aaa0a4c36a7a3024262c0324114 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 5 Apr 2011 14:06:47 +0200 Subject: [PATCH] EA-26528 - NPE: InplaceIntroduceFieldPopup$FieldInplaceIntroducer$3.run --- .../introduceField/InplaceIntroduceConstantPopup.java | 4 ++-- .../introduceField/InplaceIntroduceFieldPopup.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java index 1f2f0cee73c6..5f34e07a9ab3 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java @@ -418,11 +418,11 @@ public class InplaceIntroduceConstantPopup { } } - if (myAnchorIdxIfAll != -1) { + if (myAnchorIdxIfAll != -1 && myOccurrences[myAnchorIdxIfAll] != null) { myAnchorElementIfAll = myOccurrences[myAnchorIdxIfAll].getParent(); } - if (myAnchorIdx != -1) { + if (myAnchorIdx != -1 && myOccurrences[myAnchorIdx] != null) { myAnchorElement = myOccurrences[myAnchorIdx].getParent(); } myOccurrenceMarkers = null; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java index 7e2f140c9820..6a8f6e64a3eb 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java @@ -335,8 +335,8 @@ public class InplaceIntroduceFieldPopup { final BaseExpressionToFieldHandler.ConvertToFieldRunnable convertToFieldRunnable = new BaseExpressionToFieldHandler.ConvertToFieldRunnable(myInitializerExpression, settings, settings.getForcedType(), myOccurrences, myOccurenceManager, - myAnchorIdxIfAll != -1? myOccurrences[myAnchorIdxIfAll].getParent() : myAnchorElementIfAll, - myAnchorIdx != -1 ? myOccurrences[myAnchorIdx].getParent() : myAnchorElement, myEditor, + myAnchorIdxIfAll != -1 && myOccurrences[myAnchorIdxIfAll] != null ? myOccurrences[myAnchorIdxIfAll].getParent() : myAnchorElementIfAll, + myAnchorIdx != -1 && myOccurrences[myAnchorIdx] != null ? myOccurrences[myAnchorIdx].getParent() : myAnchorElement, myEditor, myParentClass); convertToFieldRunnable.run(); }