From e9729f75731a1a983a9939f38338f9ff1a46a9a0 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Fri, 7 Jul 2023 10:53:02 +0200 Subject: [PATCH] JAL-4199 Perform null check for annotation sequenceRef --- src/jalview/ws2/actions/annotation/AnnotationTask.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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(); -- 1.7.10.2