fix NPE when applets stop. seems to make the simple applet alignment+structure exampl...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Wed, 3 Aug 2011 13:00:12 +0000 (14:00 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Wed, 3 Aug 2011 13:00:12 +0000 (14:00 +0100)
src/jalview/structure/StructureSelectionManager.java

index c4dda8b..e6634fc 100644 (file)
@@ -789,13 +789,24 @@ public class StructureSelectionManager
    */
   public static void release(StructureSelectionManagerProvider jalviewLite)
   {
-    StructureSelectionManager mnger=(instances.get(jalviewLite));
-    if (mnger!=null)
+//    synchronized (instances)
     {
-      instances.remove(jalviewLite);
-      try {
-        mnger.finalize();
-      } catch (Throwable x){};
+      if (instances == null)
+      {
+        return;
+      }
+      StructureSelectionManager mnger = (instances.get(jalviewLite));
+      if (mnger != null)
+      {
+        instances.remove(jalviewLite);
+        try
+        {
+          mnger.finalize();
+        } catch (Throwable x)
+        {
+        }
+        ;
+      }
     }
   }