mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-377 NPE in pure python project
This commit is contained in:
+7
-2
@@ -2,7 +2,9 @@ package com.jetbrains.edu.learning.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.refactoring.actions.RenameElementAction;
|
||||
import com.jetbrains.edu.learning.StudyUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -15,8 +17,11 @@ public class StudyRenameTaskFileAction extends RenameElementAction {
|
||||
}
|
||||
|
||||
private static boolean isTaskFile(PsiElement element) {
|
||||
return element != null && StudyUtils.getTaskFile(element.getProject(),
|
||||
element.getContainingFile().getVirtualFile()) != null;
|
||||
if (element == null || element instanceof PsiDirectory) {
|
||||
return false;
|
||||
}
|
||||
PsiFile file = element.getContainingFile();
|
||||
return file != null && StudyUtils.getTaskFile(element.getProject(), file.getVirtualFile()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user