JAL-1152 avoid NPE on null alignment annotation vector
authorJim Procter <jprocter@dundee.ac.uk>
Sun, 23 Nov 2014 16:21:34 +0000 (16:21 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Sun, 23 Nov 2014 16:21:34 +0000 (16:21 +0000)
src/jalview/analysis/AnnotationSorter.java
src/jalview/gui/PopupMenu.java

index a5d2164..81398eb 100644 (file)
@@ -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);
 
index 36811c7..8467c66 100644 (file)
@@ -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)
           {