Add null check for session
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 15 Sep 2015 16:52:20 +0000 (18:52 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 15 Sep 2015 16:52:20 +0000 (18:52 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchView.java

index 6eb54ff1ce7d588055501526c0fb94951b86b5f6..8a14a5a73030305a3b687c1dfed1dc7feb7ccab6 100644 (file)
@@ -96,7 +96,7 @@ public class DerivateSearchView extends ViewPart implements IContextListener, IC
     }
 
     private void initSession() {
-        if(CdmStore.isActive() && cdmEntitySession == null) {
+        if(CdmStore.isActive()) {
             cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
         }
     }
@@ -126,7 +126,9 @@ public class DerivateSearchView extends ViewPart implements IContextListener, IC
             conversationHolder.close();
         }
 
-        cdmEntitySession.dispose();
+        if(cdmEntitySession != null) {
+            cdmEntitySession.dispose();
+        }
         super.dispose();
     }