JAL-1759 added check for null (console 'history')
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 26 Aug 2015 11:03:45 +0000 (12:03 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 26 Aug 2015 11:03:45 +0000 (12:03 +0100)
src/jalview/appletgui/AppletJmol.java
src/jalview/appletgui/AppletJmolBinding.java

index e889467..0379615 100644 (file)
@@ -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);
+    }
+  }
 }
index 7035058..6ec5b4d 100644 (file)
@@ -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);
     }
   }