bugfix for NPE for details view of NonViralNames (#2867)
authorAndreas Müller <a.mueller@bgbm.org>
Wed, 28 Mar 2012 12:42:54 +0000 (12:42 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Wed, 28 Mar 2012 12:42:54 +0000 (12:42 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java

index d68e8fcaec14c75bc3c020f34b8a853563b01581..f628e9e26cb2b2b359cbfc8f9c9dc20cf64aa93d 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Arrays;
 import org.eclipse.swt.SWT;
 
 import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.cdm.model.name.ZoologicalName;
@@ -119,13 +120,16 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
 
        private void createSpecificNameParts(ICdmFormElement formElement,
                        NonViralName nonViralName, int style) {
-               switch(nonViralName.getNomenclaturalCode()){
-               case ICBN:
-                       createBotanicalNameParts(formElement, nonViralName, style);
-                       break;
-               case ICZN:
-                       createZoologicalNameParts(formElement, nonViralName, style);
-                       break;
+               NomenclaturalCode code = nonViralName.getNomenclaturalCode();
+               if (code != null){
+                       switch(nonViralName.getNomenclaturalCode()){
+                       case ICBN:
+                               createBotanicalNameParts(formElement, nonViralName, style);
+                               break;
+                       case ICZN:
+                               createZoologicalNameParts(formElement, nonViralName, style);
+                               break;
+                       }
                }
        }