JAL-1136 sometimes there are no parameters associated with a CalcId key
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 28 Aug 2012 13:06:03 +0000 (14:06 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 28 Aug 2012 13:06:03 +0000 (14:06 +0100)
src/jalview/gui/Jalview2XML.java

index 6acd421..ee67b55 100644 (file)
@@ -1236,12 +1236,18 @@ public class Jalview2XML
         }
       }
     }
-    if (calcIdSet.size()>0)
+    if (calcIdSet.size() > 0)
     {
-      for (String calcId:calcIdSet)
+      for (String calcId : calcIdSet)
       {
-        if (calcId.trim().length()>0) {
-          view.addCalcIdParam(createCalcIdParam(calcId, av));
+        if (calcId.trim().length() > 0)
+        {
+          CalcIdParam cidp = createCalcIdParam(calcId, av);
+          // Some calcIds have no parameters.
+          if (cidp != null)
+          {
+            view.addCalcIdParam(cidp);
+          }
         }
       }
     }
@@ -3363,13 +3369,20 @@ public class Jalview2XML
                 );
       }
     }
-    if (view.getCalcIdParam()!=null)
+    if (view.getCalcIdParam() != null)
     {
-      for (CalcIdParam calcIdParam:view.getCalcIdParam())
+      for (CalcIdParam calcIdParam : view.getCalcIdParam())
       {
-        if (recoverCalcIdParam(calcIdParam, af.viewport)) {
-        } else {
-          warn("Couldn't recover parameters for "+calcIdParam.getCalcId());
+        if (calcIdParam != null)
+        {
+          if (recoverCalcIdParam(calcIdParam, af.viewport))
+          {
+          }
+          else
+          {
+            warn("Couldn't recover parameters for "
+                    + calcIdParam.getCalcId());
+          }
         }
       }
     }