From feda4a6c19b530b08c3dca57abb86cd70412e984 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 13 Aug 2008 13:47:10 +0000 Subject: [PATCH] check for null viewport on dataset recovery --- src/jalview/gui/PCAPanel.java | 2 +- src/jalview/gui/TreePanel.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 15c3d59..06f1b25 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -283,7 +283,7 @@ public class PCAPanel // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]); Alignment al = new Alignment( (SequenceI[]) alAndColsel[0]); - Alignment dataset = av.getAlignment().getDataset(); + Alignment dataset = (av!=null && av.getAlignment()!=null) ? av.getAlignment().getDataset() : null; if (dataset != null) { al.setDataset(dataset); diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 762ad58..f85ad9c 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -416,6 +416,7 @@ public class TreePanel // but this may fail if the view was closed... gc = av. getGapCharacter(); + } catch (Exception ex) {}; Object[] alAndColsel = tree.seqData.getAlignmentAndColumnSelection(gc); @@ -424,7 +425,7 @@ public class TreePanel // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]); Alignment al = new Alignment( (SequenceI[]) alAndColsel[0]); - Alignment dataset = av.getAlignment().getDataset(); + Alignment dataset = (av!=null && av.getAlignment()!=null) ? av.getAlignment().getDataset() : null; if (dataset != null) { al.setDataset(dataset); -- 1.7.10.2