inspection tool window: NPE when ref-entity is null fixed + QF button can be disabled

This commit is contained in:
Dmitry Batkovich
2016-03-15 09:54:36 +03:00
parent 45be7bae39
commit 4356d5fcc7
2 changed files with 4 additions and 1 deletions
@@ -486,7 +486,9 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
}
private JComponent createBaseRightComponentFor(int problemCount, RefEntity selectedEntity) {
if (selectedEntity instanceof RefElement && !(((RefElement)selectedEntity).getElement() instanceof PsiDirectory)) {
if (selectedEntity instanceof RefElement &&
selectedEntity.isValid() &&
!(((RefElement)selectedEntity).getElement() instanceof PsiDirectory)) {
PsiElement selectedElement = ((RefElement)selectedEntity).getElement();
if (problemCount == 1) {
CommonProblemDescriptor[] descriptors = myTree.getSelectedDescriptors();
@@ -258,6 +258,7 @@ public class QuickFixToolbar extends JPanel implements InspectionTreeLoadingProg
if (icon == null) {
icon = AllIcons.Actions.CreateFromUsage;
}
button.setEnabled(presentation.isEnabled());
button.setIcon(IconLoader.getTransparentIcon(icon, 0.75f));
new ClickListener() {
@Override