mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
getContainingFile() can be null in DBE
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user