Add check to make sure active session is not null
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / taxeditor / session / DefaultNewEntityListener.java
index 7ce1808ac77d4a8e4b82d6a9c678e0472c412c04..dc519d8a001fd43f1e8a4227d3b72a9a5d2453f5 100644 (file)
@@ -32,7 +32,10 @@ public class DefaultNewEntityListener implements NewEntityListener {
     public void onCreate(CdmBase cdmBase) {
         logger.info("New Entity created : " + cdmBase);
         if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){
-            ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession().addNewCdmEntity(cdmBase);
+            ICdmEntitySession activeSession = ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
+            if(activeSession != null) {
+                activeSession.addNewCdmEntity(cdmBase);
+            }
         }
     }