From fc5e52367e1de3063c0f10faa68e8ffb5451ad84 Mon Sep 17 00:00:00 2001 From: Gregory Shrago Date: Mon, 30 Nov 2009 17:46:52 +0300 Subject: [PATCH] IDEADEV-41702 NPE - InjectLanguageAction.findInjectionHost --- .../org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java index eb42a8a5cb..5464a9d0d3 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java @@ -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 manipulator = ElementManipulators.getManipulator(host); + if (manipulator == null) return null; + final TextRange textRange = manipulator.getRangeInElement(host); if (textRange.getStartOffset() == 0) return null; return host; } -- 2.11.4.GIT