From: jprocter Date: Fri, 2 Apr 2010 09:39:51 +0000 (+0000) Subject: avoid occasional null exception X-Git-Tag: Release_2_5~92 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fbf08a1f5a164914fef4214778a24775891eead4;p=jalview.git avoid occasional null exception --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 7a8789d..77cf56f 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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()); + } } }