extract functional: skip if element was invalidated (IDEA-174178)

when typed to the editor between dialog is closed and popup was shown
This commit is contained in:
Anna Kozlova
2017-06-08 17:49:07 +03:00
parent 5a5cfb7b2f
commit 703283b008
2 changed files with 4 additions and 0 deletions
@@ -639,6 +639,9 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase {
final PsiType selectedType,
final ExtractMethodProcessor processor,
final PsiElement[] elements) {
if (!elements[0].isValid()) {
return;
}
final PsiElement commonParent = findCommonParent(elements);
if (commonParent == null) {
LOG.error("Should have common parent:" + Arrays.toString(elements));
@@ -115,6 +115,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
Editor editor,
MyExtractMethodProcessor processor,
PsiElement[] elements) {
if (!elements[0].isValid()) return;
if (!CommonRefactoringUtil.checkReadOnlyStatus(project, elements[0])) return;
MyExtractMethodProcessor physicalProcessor =
new MyExtractMethodProcessor(project, editor, elements,