From 46b0a2d1b462cbf1f910d9bab22e4326ab6562e0 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 26 Aug 2015 12:03:45 +0100 Subject: [PATCH] JAL-1759 added check for null (console 'history') --- src/jalview/appletgui/AppletJmol.java | 16 +++++++++++++++- src/jalview/appletgui/AppletJmolBinding.java | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index e889467..0379615 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -558,7 +558,7 @@ public class AppletJmol extends EmbmenuFrame implements if (evt.getKeyCode() == KeyEvent.VK_ENTER && scriptWindow.isVisible()) { jmb.eval(inputLine.getText()); - history.append("\n$ " + inputLine.getText()); + addToHistory("$ " + inputLine.getText()); inputLine.setText(""); } @@ -701,4 +701,18 @@ public class AppletJmol extends EmbmenuFrame implements } return ap; } + + /** + * Append the given text to the history object + * + * @param text + */ + public void addToHistory(String text) + { + // actually currently never initialised + if (history != null) + { + history.append("\n" + text); + } + } } diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 7035058..6ec5b4d 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -87,7 +87,7 @@ class AppletJmolBinding extends JalviewJmolBinding appletJmolBinding.showConsole(true); } - appletJmolBinding.history.append("\n" + strEcho); + appletJmolBinding.addToHistory(strEcho); } @Override @@ -96,7 +96,7 @@ class AppletJmolBinding extends JalviewJmolBinding if (appletJmolBinding.history != null && strStatus != null && !strStatus.equals("Script completed")) { - appletJmolBinding.history.append("\n" + strStatus); + appletJmolBinding.addToHistory(strStatus); } } -- 1.7.10.2