From: gmungoc Date: Wed, 26 Aug 2015 11:03:45 +0000 (+0100) Subject: JAL-1759 added check for null (console 'history') X-Git-Tag: Jalview_2_9~10^2~25 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=46b0a2d1b462cbf1f910d9bab22e4326ab6562e0;p=jalview.git JAL-1759 added check for null (console 'history') --- 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); } }