JAL-1912 Double.NaN breaks JSON serialization - added check to prevent this
[jalview.git] / src / jalview / io / JSONFile.java
index 4e293db..7e7052f 100644 (file)
@@ -374,7 +374,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
       AlignmentAnnotationPojo alignAnnotPojo = new AlignmentAnnotationPojo();
       alignAnnotPojo.setDescription(annot.description);
       alignAnnotPojo.setLabel(annot.label);
-      alignAnnotPojo.setScore(annot.score);
+      if (!Double.isNaN(annot.score))
+      {
+        alignAnnotPojo.setScore(annot.score);
+      }
       alignAnnotPojo.setCalcId(annot.getCalcId());
       alignAnnotPojo.setGraphType(annot.graph);
 
@@ -528,11 +531,6 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
               .hasNext();)
       {
         JSONObject alAnnot = alAnnotIter.next();
-        if (alAnnot == null)
-        {
-          continue;
-        }
-
         JSONArray annotJsonArray = (JSONArray) alAnnot.get("annotations");
         Annotation[] annotations = new Annotation[annotJsonArray.size()];
         int count = 0;