From: jprocter Date: Wed, 3 Aug 2011 13:00:12 +0000 (+0100) Subject: fix NPE when applets stop. seems to make the simple applet alignment+structure exampl... X-Git-Tag: Release_2_7~117 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cfbf1b2d6661bb62b2b8748b4c29c12690c7b0b4;p=jalview.git fix NPE when applets stop. seems to make the simple applet alignment+structure example work again (JAL-592 ?) --- diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index c4dda8b..e6634fc 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -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) + { + } + ; + } } }