Fix for potential NullPointer exception if the results are an empty file
[jabaws.git] / datamodel / compbio / data / sequence / ScoreManager.java
index cabf507..d16a059 100644 (file)
@@ -116,7 +116,13 @@ public class ScoreManager {
        }\r
 \r
        public void writeOut(Writer outStream) throws IOException {\r
+               assert outStream != null : "Output steam is not defined!";\r
+               if (seqScores == null) {\r
+                       return;\r
+               }\r
                for (ScoreHolder oneSeqScores : seqScores) {\r
+                       if (oneSeqScores == null)\r
+                               continue;\r
                        oneSeqScores.writeOut(outStream);\r
                }\r
        }\r
@@ -220,4 +226,5 @@ public class ScoreManager {
                }\r
 \r
        }\r
+\r
 }\r