check for null annotations
authoramwaterhouse <Andrew Waterhouse>
Tue, 8 May 2007 13:47:57 +0000 (13:47 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 8 May 2007 13:47:57 +0000 (13:47 +0000)
src/jalview/gui/AlignFrame.java

index 3c74f43..5b56680 100755 (executable)
@@ -1050,7 +1050,7 @@ public class AlignFrame
   }
 
   /**
-   * 
+   *
    * @return alignment objects for all views
    */
   AlignmentI[] getViewAlignments()
@@ -1607,7 +1607,7 @@ public class AlignFrame
        }
      }
      if (!newAlignment) {
-       
+
        // propagate alignment changed.
        viewport.setEndSeq(alignment.getHeight());
        if (annotationAdded)
@@ -1640,7 +1640,7 @@ public class AlignFrame
          buildSortByAnnotationScoresMenu();
        }
        viewport.firePropertyChange("alignment", null, alignment.getSequences());
-      
+
      } else {
        AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT);
        String newtitle = new String("Copied sequences");
@@ -3129,6 +3129,11 @@ public class AlignFrame
    */
   public void buildSortByAnnotationScoresMenu()
   {
+    if(viewport.alignment.getAlignmentAnnotation()==null)
+    {
+      return;
+    }
+
     if (viewport.alignment.getAlignmentAnnotation().hashCode()!=_annotationScoreVectorHash)
     {
       sortByAnnotScore.removeAll();
@@ -3154,6 +3159,9 @@ public class AlignFrame
       }
       sortByAnnotScore.setVisible(scoreSorts.size()>0);
       scoreSorts.clear();
+
+      _annotationScoreVectorHash =
+          viewport.alignment.getAlignmentAnnotation().hashCode();
     }
   }