Fix possible NPE
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 1 Dec 2015 14:38:32 +0000 (15:38 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 2 Dec 2015 10:09:38 +0000 (11:09 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java

index 630eef093a2ab5333fbadc7e6860ac6ba3207abf..0d587c2c294ef79004b03d65294866780e5c27f4 100644 (file)
@@ -491,13 +491,15 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
                     }
                 }
             }
-            Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon(selectedTaxon, null, null);
-            Collection<UUID> uuids = new HashSet<UUID>();
-            for (SpecimenOrObservationBase specimenOrObservationBase : fieldUnits) {
-                uuids.add(specimenOrObservationBase.getUuid());
+            if(selectedTaxon!=null){
+                Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon(selectedTaxon, null, null);
+                Collection<UUID> uuids = new HashSet<UUID>();
+                for (SpecimenOrObservationBase specimenOrObservationBase : fieldUnits) {
+                    uuids.add(specimenOrObservationBase.getUuid());
+                }
+                updateRootEntities(uuids);
+                setPartName("Derivative Editor: " + selectedTaxon.getName());
             }
-            updateRootEntities(uuids);
-            setPartName("Derivative Editor: " + selectedTaxon.getName());
         }
     }