diff --git a/RegExpSupport/src/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspection.java b/RegExpSupport/src/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspection.java index 4c0004233d68..d07130ad5f7e 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspection.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspection.java @@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.PsiErrorElement; import com.intellij.psi.util.PsiTreeUtil; import org.intellij.lang.regexp.RegExpBundle; import org.intellij.lang.regexp.RegExpTT; @@ -107,7 +108,7 @@ public class RegExpSimplifiableInspection extends LocalInspectionTool { @Override public void visitRegExpQuantifier(RegExpQuantifier quantifier) { - if (!quantifier.isCounted()) { + if (!quantifier.isCounted() || quantifier.getLastChild() instanceof PsiErrorElement) { return; } final RegExpNumber minElement = quantifier.getMin(); diff --git a/RegExpSupport/test/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspectionTest.java b/RegExpSupport/test/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspectionTest.java index 558f84d7172e..697b1880dd60 100644 --- a/RegExpSupport/test/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspectionTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/inspection/RegExpSimplifiableInspectionTest.java @@ -42,6 +42,10 @@ public class RegExpSimplifiableInspectionTest extends RegExpInspectionTestCase { highlightTest("[\\W&&\\S]"); } + public void testIncomplete() { + highlightTest(".{"); + } + public void testSingleElementClass() { doTest("[a]", "a"); }