From: Patrick Plitzner
Date: Tue, 21 Jul 2015 06:55:52 +0000 (+0200)
Subject: Add missing null check
X-Git-Tag: 3.8.0^2~59^2~3
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/23a531ea63909c1b455316e4152be49978ba2b36
Add missing null check
---
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java
index 8fc2e73e3..88552f12f 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java
@@ -59,22 +59,23 @@ public class CdmViewerUtil {
public static Map getAvailableViewers(Object input){
Map commandViewerNameMap = new HashMap();
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
- for (IConfigurationElement configElement : extensions) {
- if(configElement.getName().equals("viewCommandMapping")){
- String commandId = configElement.getAttribute("commandId");
- String viewerName = configElement.getAttribute("viewerName");
- try {
- Object selectionObject = configElement.createExecutableExtension("selection");
- System.out.println(selectionObject);
- Class extends Object> selectionClass = selectionObject.getClass();
- if(input.getClass().isAssignableFrom(selectionClass)){
- commandViewerNameMap.put(commandId, viewerName);
+ if(input!=null){
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
+ for (IConfigurationElement configElement : extensions) {
+ if(configElement.getName().equals("viewCommandMapping")){
+ String commandId = configElement.getAttribute("commandId");
+ String viewerName = configElement.getAttribute("viewerName");
+ try {
+ Object selectionObject = configElement.createExecutableExtension("selection");
+ Class extends Object> selectionClass = selectionObject.getClass();
+ if(input.getClass().isAssignableFrom(selectionClass)){
+ commandViewerNameMap.put(commandId, viewerName);
+ }
+ } catch (CoreException e) {
+ MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e);
}
- } catch (CoreException e) {
- MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e);
}
}
}