From ba49de7b03d0f787028755d3b13fff42e5b4ab2a Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 14 Nov 2022 18:25:40 +0100 Subject: [PATCH] [java-intentions] EA-741594 - AIOOBE: RemoveRedundantArgumentsFix$ForImplicitConstructorAction.invoke GitOrigin-RevId: e57bc39d9f506897ac92dd059f5d9d906b77ba1e --- .../daemon/impl/quickfix/RemoveRedundantArgumentsFix.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveRedundantArgumentsFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveRedundantArgumentsFix.java index 36e87fceb67c..657637ca5d21 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveRedundantArgumentsFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveRedundantArgumentsFix.java @@ -162,12 +162,13 @@ public final class RemoveRedundantArgumentsFix implements IntentionAction { @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { - return true; + return myList.isValid() && !myList.isEmpty(); } @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { PsiExpression[] expressions = myList.getExpressions(); + if (expressions.length == 0) return; myList.deleteChildRange(expressions[0], expressions[expressions.length - 1]); }