From: Jim Procter Date: Sun, 23 Nov 2014 16:21:34 +0000 (+0000) Subject: JAL-1152 avoid NPE on null alignment annotation vector X-Git-Tag: Jalview_2_9~148^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a17560ede81e39f8dba0c6d6c3fa7ccb689a124e;p=jalview.git JAL-1152 avoid NPE on null alignment annotation vector --- diff --git a/src/jalview/analysis/AnnotationSorter.java b/src/jalview/analysis/AnnotationSorter.java index a5d2164..81398eb 100644 --- a/src/jalview/analysis/AnnotationSorter.java +++ b/src/jalview/analysis/AnnotationSorter.java @@ -209,6 +209,10 @@ public class AnnotationSorter public void sort(AlignmentAnnotation[] alignmentAnnotations, SequenceAnnotationOrder order) { + if (alignmentAnnotations == null) + { + return; + } // cache 'alignment sequence position' for the annotations saveSequenceIndices(alignmentAnnotations); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 36811c7..8467c66 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -372,7 +372,7 @@ public class PopupMenu extends JPopupMenu { AlignmentAnnotation[] aa = ap.av.getAlignment() .getAlignmentAnnotation(); - for (int i = 0; i < aa.length; i++) + for (int i = 0; aa != null && i < aa.length; i++) { if (aa[i].isValidStruc() && aa[i].sequenceRef == null) {