From fbf08a1f5a164914fef4214778a24775891eead4 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 2 Apr 2010 09:39:51 +0000 Subject: [PATCH] avoid occasional null exception --- src/jalview/gui/Desktop.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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()); + } } } -- 1.7.10.2