regexp: try to prevent IAE (EA-241967)

GitOrigin-RevId: 082c7302bdf15c8ba564214869e75d1b9a5960e9
This commit is contained in:
Bas Leijdekkers
2021-10-22 16:19:30 +02:00
committed by intellij-monorepo-bot
parent ca56b88335
commit 8f228eddfa

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.lang.regexp.intention;
import com.intellij.codeInsight.highlighting.HighlightManager;
@@ -331,6 +331,7 @@ public final class CheckRegExpForm {
for (RegExpMatch match : matches) {
final int start = match.start(group);
final int end = match.end(group);
if (start < 0 || end < 0) continue;
if (group != 0 || start != 0 || end != mySampleText.getText().length()) {
highlightManager.addRangeHighlight(editor, start, end, RegExpHighlighter.MATCHED_GROUPS, true, mySampleHighlights);
}