null pointer exception and warning for update of tree
[jalview.git] / src / jalview / io / vamsas / Tree.java
index 28e3c2d..a45c98d 100644 (file)
@@ -226,14 +226,18 @@ public class Tree extends DatastoreItem
    * 
    * Update jalview newick representation with TreeNode map
    * 
-   * @param tp
-   *                the treepanel that this tree is bound to.
+   * @param tp the treepanel that this tree is bound to.
    */
   public void UpdateSequenceTreeMap(TreePanel tp)
   {
     if (tp == null || tree == null)
       return;
     Vector leaves = new Vector();
+    if (tp.getTree()==null)
+    {
+      Cache.log.warn("Not updating SequenceTreeMap for "+tree.getVorbaId());
+      return;
+    }
     tp.getTree().findLeaves(tp.getTree().getTopNode(), leaves);
     Treenode[] tn = tree.getTreenode(); // todo: select nodes for this
                                         // particular tree