diff --git a/source/com/intellij/refactoring/extractMethod/ExtractMethodHandler.java b/source/com/intellij/refactoring/extractMethod/ExtractMethodHandler.java index 4338c3e377cb..f4108fb79e63 100644 --- a/source/com/intellij/refactoring/extractMethod/ExtractMethodHandler.java +++ b/source/com/intellij/refactoring/extractMethod/ExtractMethodHandler.java @@ -127,10 +127,12 @@ public class ExtractMethodHandler implements RefactoringActionHandler { } public void invoke(Project project, PsiElement[] elements, DataContext dataContext) { - final PsiFile file = (PsiFile)dataContext.getData(DataConstants.PSI_FILE); - final Editor editor = (Editor)dataContext.getData(DataConstants.EDITOR); - if (file != null && editor != null) { - invokeOnElements(elements, project, file, editor); + if (dataContext != null) { + final PsiFile file = (PsiFile)dataContext.getData(DataConstants.PSI_FILE); + final Editor editor = (Editor)dataContext.getData(DataConstants.EDITOR); + if (file != null && editor != null) { + invokeOnElements(elements, project, file, editor); + } } } } \ No newline at end of file