SSR: fix AIOOBE when pattern did not produce any psi elements (IDEA-204490)

GitOrigin-RevId: ea34764a7a5d5bdb26fa7d4029f60a360a6e22a2
This commit is contained in:
Bas Leijdekkers
2019-06-11 18:09:06 +03:00
committed by intellij-monorepo-bot
parent 5aca92658b
commit f5ee1db0b8
@@ -1,4 +1,4 @@
// Copyright 2000-2018 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-2019 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.
package com.intellij.structuralsearch.impl.matcher.compiler;
import com.intellij.dupLocator.util.NodeFilter;
@@ -116,6 +116,9 @@ public class GlobalCompilingVisitor {
}
void compile(PsiElement[] elements, CompileContext context) {
if (elements.length == 0) {
throw new MalformedPatternException();
}
myCodeBlockLevel = 0;
this.context = context;
final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(context.getOptions().getFileType());