From: Jim Procter Date: Fri, 31 May 2013 16:09:33 +0000 (+0100) Subject: JAL-1259 patch to avoid NPE X-Git-Tag: Release_2_8_0b1~1^2~63^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5ef242d44b8db9edeae9523ad76a5065cb6ef999;p=jalview.git JAL-1259 patch to avoid NPE --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 83aab4e..1553710 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1385,13 +1385,17 @@ public class Alignment implements AlignmentI SequenceGroup groupRef) { assert (name != null); - for (AlignmentAnnotation annot : getAlignmentAnnotation()) + if (annotations != null) { - if (annot.autoCalculated == autoCalc && (name.equals(annot.label)) - && (calcId == null || annot.getCalcId().equals(calcId)) - && annot.sequenceRef == seqRef && annot.groupRef == groupRef) + for (AlignmentAnnotation annot : getAlignmentAnnotation()) { - return annot; + if (annot.autoCalculated == autoCalc && (name.equals(annot.label)) + && (calcId == null || annot.getCalcId().equals(calcId)) + && annot.sequenceRef == seqRef + && annot.groupRef == groupRef) + { + return annot; + } } } AlignmentAnnotation annot = new AlignmentAnnotation(name, name,