mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEADEV-41702 NPE - InjectLanguageAction.findInjectionHost
This commit is contained in:
+3
-1
@@ -77,7 +77,9 @@ public class InjectLanguageAction implements IntentionAction {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
final PsiLanguageInjectionHost host = PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiLanguageInjectionHost.class, false);
|
||||
if (host == null) return null;
|
||||
final TextRange textRange = ElementManipulators.getManipulator(host).getRangeInElement(host);
|
||||
final ElementManipulator<PsiLanguageInjectionHost> manipulator = ElementManipulators.getManipulator(host);
|
||||
if (manipulator == null) return null;
|
||||
final TextRange textRange = manipulator.getRangeInElement(host);
|
||||
if (textRange.getStartOffset() == 0) return null;
|
||||
return host;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user