From 03096bd6cafc7d5b10396c5e7cf7086e8d6358a5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 14 Dec 2016 15:36:13 +0000 Subject: [PATCH] JAL-2360 added check for null annotations array --- src/jalview/datamodel/Alignment.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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; -- 1.7.10.2