From a17560ede81e39f8dba0c6d6c3fa7ccb689a124e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 23 Nov 2014 16:21:34 +0000 Subject: [PATCH] JAL-1152 avoid NPE on null alignment annotation vector --- src/jalview/analysis/AnnotationSorter.java | 4 ++++ src/jalview/gui/PopupMenu.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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) { -- 1.7.10.2