From: gmungoc Date: Wed, 14 Dec 2016 15:36:13 +0000 (+0000) Subject: JAL-2360 added check for null annotations array X-Git-Tag: Release_2_10_3b1~357^2~55 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=03096bd6cafc7d5b10396c5e7cf7086e8d6358a5;p=jalview.git JAL-2360 added check for null annotations array --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 290707d..49f6268 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1561,7 +1561,6 @@ public class Alignment implements AlignmentI String calcId, boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef) { - assert (name != null); if (annotations != null) { for (AlignmentAnnotation annot : getAlignmentAnnotation()) @@ -1593,14 +1592,18 @@ public class Alignment implements AlignmentI @Override public Iterable findAnnotation(String calcId) { - ArrayList aa = new ArrayList(); - for (AlignmentAnnotation a : getAlignmentAnnotation()) + List aa = new ArrayList(); + AlignmentAnnotation[] alignmentAnnotation = getAlignmentAnnotation(); + if (alignmentAnnotation != null) { - if (a.getCalcId() == calcId - || (a.getCalcId() != null && calcId != null && a.getCalcId() - .equals(calcId))) + for (AlignmentAnnotation a : alignmentAnnotation) { - aa.add(a); + if (a.getCalcId() == calcId + || (a.getCalcId() != null && calcId != null && a + .getCalcId().equals(calcId))) + { + aa.add(a); + } } } return aa;