avoid occasional null exception
authorjprocter <Jim Procter>
Fri, 2 Apr 2010 09:39:51 +0000 (09:39 +0000)
committerjprocter <Jim Procter>
Fri, 2 Apr 2010 09:39:51 +0000 (09:39 +0000)
src/jalview/gui/Desktop.java

index 7a8789d..77cf56f 100755 (executable)
@@ -1650,11 +1650,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         if (percentUsage < 20)
           g.setColor(Color.red);
-
-        g.drawString("Total Free Memory: " + df.format(totalFreeMemory)
+        FontMetrics fm = g.getFontMetrics();
+        if (fm!=null)
+        { g.drawString("Total Free Memory: " + df.format(totalFreeMemory)
                 + "MB; Max Memory: " + df.format(maxMemory) + "MB; "
                 + df.format(percentUsage) + "%", 10, getHeight()
-                - g.getFontMetrics().getHeight());
+                - fm.getHeight());
+        }
       }
     }