NPE (IDEA-160916)

This commit is contained in:
Anna Kozlova
2016-09-07 16:25:37 +03:00
parent 9c8003c077
commit ba6afd421f
2 changed files with 4 additions and 3 deletions
@@ -28,6 +28,7 @@ import com.intellij.codeInspection.ui.InspectionTreeNode;
import com.intellij.codeInspection.util.RefFilter;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class DummyEntryPointsPresentation extends UnusedDeclarationPresentation {
private static final RefEntryPointFilter myFilter = new RefEntryPointFilter();
@@ -43,7 +44,7 @@ public class DummyEntryPointsPresentation extends UnusedDeclarationPresentation
}
@Override
public QuickFixAction[] getQuickFixes(@NotNull final RefEntity[] refElements, InspectionTree tree) {
public QuickFixAction[] getQuickFixes(@NotNull final RefEntity[] refElements, @Nullable InspectionTree tree) {
if (myQuickFixActions == null) {
myQuickFixActions = new QuickFixAction[]{new MoveEntriesToSuspicious(getToolWrapper())};
}
@@ -192,7 +192,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
}
@Override
public QuickFixAction[] getQuickFixes(@NotNull final RefEntity[] refElements, InspectionTree tree) {
public QuickFixAction[] getQuickFixes(@NotNull final RefEntity[] refElements, @Nullable InspectionTree tree) {
boolean showFixes = false;
for (RefEntity element : refElements) {
if (!getIgnoredRefElements().contains(element) && element.isValid()) {
@@ -202,7 +202,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
}
if (showFixes) {
final TreePath[] paths = tree.getSelectionPaths();
final TreePath[] paths = tree != null ? tree.getSelectionPaths() : null;
if (paths != null) {
long count = Arrays.stream(paths).map(TreePath::getLastPathComponent)
.filter(component -> component instanceof ProblemDescriptionNode).count();