Bug 574657 - null check in ContentTypeDecorator
NPE during build
on shutdown there is no registry anymore
Change-Id: Ibb3b5d87fda5c178036da893a885fe06eccdef9e
Signed-off-by: Joerg Kubitz <jkubitz-eclipse@gmx.de>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/182761
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ContentTypeDecorator.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ContentTypeDecorator.java
index 3b65a62..0aec895 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ContentTypeDecorator.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ContentTypeDecorator.java
@@ -23,6 +23,7 @@
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
@@ -70,7 +71,10 @@
if (contentDescription != null) {
IContentType contentType = contentDescription.getContentType();
if (contentType != null) {
- image= workbench.getEditorRegistry().getImageDescriptor(file.getName(), contentType);
+ IEditorRegistry editorRegistry = workbench.getEditorRegistry();
+ if (editorRegistry != null) { // on shutdown there is no registry anymore (bug 574657)
+ image = editorRegistry.getImageDescriptor(file.getName(), contentType);
+ }
}
}
}