JAL-1596 check for null pointer (thread running after viewer closed)
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 26 Aug 2015 14:30:50 +0000 (15:30 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 26 Aug 2015 14:30:50 +0000 (15:30 +0100)
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java

index b648bea..368918b 100644 (file)
  */
 package jalview.ext.rbvi.chimera;
 
-import java.awt.Color;
-import java.net.BindException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
-import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
-import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
-import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
-
 import jalview.api.AlignmentViewPanel;
 import jalview.api.FeatureRenderer;
 import jalview.api.SequenceRenderer;
@@ -49,6 +37,18 @@ import jalview.structure.StructureSelectionManager;
 import jalview.structures.models.AAStructureBindingModel;
 import jalview.util.MessageManager;
 
+import java.awt.Color;
+import java.net.BindException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
+import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
+
 public abstract class JalviewChimeraBinding extends AAStructureBindingModel
 {
   // Chimera clause to exclude alternate locations in atom selection
@@ -608,6 +608,11 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
    */
   public void sendChimeraCommand(final String command, boolean logResponse)
   {
+    if (viewer == null)
+    {
+      // ? thread running after viewer shut down
+      return;
+    }
     viewerCommandHistory(false);
     if (lastCommand == null || !lastCommand.equals(command))
     {