From 80fc2b72089a6f6296396cae58b415429c65d0f7 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 15 Oct 2015 15:31:29 +0300 Subject: [PATCH] getContainingFile() can be null in DBE --- platform/core-api/src/com/intellij/psi/impl/ElementBase.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/core-api/src/com/intellij/psi/impl/ElementBase.java b/platform/core-api/src/com/intellij/psi/impl/ElementBase.java index fb982fbadcbf..b2f5a7284eb4 100644 --- a/platform/core-api/src/com/intellij/psi/impl/ElementBase.java +++ b/platform/core-api/src/com/intellij/psi/impl/ElementBase.java @@ -104,15 +104,14 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable @Nullable private Icon computeIcon(@Iconable.IconFlags int flags) { PsiElement psiElement = (PsiElement)this; - PsiFile psiFile = psiElement.getContainingFile(); - if (psiFile == null || !psiFile.isValid()) return null; + if (!psiElement.isValid()) return null; if (Registry.is("psi.deferIconLoading")) { Icon baseIcon = LastComputedIcon.get(psiElement, flags); if (baseIcon == null) { baseIcon = computeBaseIcon(flags); } - return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, psiFile.getProject(), flags), ICON_COMPUTE); + return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, psiElement.getProject(), flags), ICON_COMPUTE); } return computeIconNow(psiElement, flags);