JAL-2183 defensive check for openFrameCount < 0 (shouldn't happen but
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 30 Aug 2016 14:58:47 +0000 (15:58 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 30 Aug 2016 14:58:47 +0000 (15:58 +0100)
did)

src/jalview/gui/Desktop.java

index 7811e41..3cc2c14 100644 (file)
@@ -825,7 +825,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements
               javax.swing.event.InternalFrameEvent evt)
       {
         PaintRefresher.RemoveComponent(frame);
-        openFrameCount--;
+
+        /*
+         * defensive check to prevent frames being
+         * added half off the window
+         */
+        if (openFrameCount > 0)
+        {
+          openFrameCount--;
+        }
         windowMenu.remove(menuItem);
         JInternalFrame itf = desktop.getSelectedFrame();
         if (itf != null)