From: Mateusz Warowny Date: Fri, 7 Jul 2023 08:53:02 +0000 (+0200) Subject: JAL-4199 Perform null check for annotation sequenceRef X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e9729f75731a1a983a9939f38338f9ff1a46a9a0;p=jalview.git JAL-4199 Perform null check for annotation sequenceRef --- diff --git a/src/jalview/ws2/actions/annotation/AnnotationTask.java b/src/jalview/ws2/actions/annotation/AnnotationTask.java index ed67643..a448b3c 100644 --- a/src/jalview/ws2/actions/annotation/AnnotationTask.java +++ b/src/jalview/ws2/actions/annotation/AnnotationTask.java @@ -155,15 +155,18 @@ public class AnnotationTask extends BaseTask List annotations = new ArrayList<>(); for (AlignmentAnnotation ala : returnedAnnot) { - SequenceI seq = job.seqNames.get(ala.sequenceRef.getName()); - SequenceI aseq = seq.getRootDatasetSequence(); - Annotation[] gappedAnnots = createGappedAnnotations(ala.annotations, job.start, job.gapMap); + SequenceI aseq = null; + if (ala.sequenceRef != null) { + SequenceI seq = job.seqNames.get(ala.sequenceRef.getName()); + aseq = seq.getRootDatasetSequence(); + } ala.sequenceRef = aseq; + Annotation[] gappedAnnots = createGappedAnnotations(ala.annotations, job.start, job.gapMap); ala.annotations = gappedAnnots; AlignmentAnnotation newAnnot = viewport.getAlignment() .updateFromOrCopyAnnotation(ala); - if (aseq != null) // I suspect it's always true + if (aseq != null) { aseq.addAlignmentAnnotation(newAnnot); newAnnot.adjustForAlignment();