JAL-2175 code/test fixes/tidy for PFAM/MSF/JSON roundtrip
[jalview.git] / src / jalview / io / JSONFile.java
index 36980f8..653c071 100644 (file)
@@ -735,6 +735,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
   @Override
   public void configureForView(AlignmentViewPanel avpanel)
   {
+    if (avpanel == null)
+    {
+      return;
+    }
     super.configureForView(avpanel);
     AlignViewportI viewport = avpanel.getAlignViewport();
     AlignmentI alignment = viewport.getAlignment();
@@ -744,11 +748,14 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     fr = avpanel.cloneFeatureRenderer();
 
     // Add non auto calculated annotation to AlignFile
-    for (AlignmentAnnotation annot : annots)
+    if (annots != null)
     {
-      if (annot != null && !annot.autoCalculated)
+      for (AlignmentAnnotation annot : annots)
       {
-        annotations.add(annot);
+        if (annot != null && !annot.autoCalculated)
+        {
+          annotations.add(annot);
+        }
       }
     }
     globalColourScheme = ColourSchemeProperty.getColourName(viewport