Fix for potential NullPointer exception if the results are an empty file
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 8 Nov 2011 16:19:29 +0000 (16:19 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 8 Nov 2011 16:19:29 +0000 (16:19 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4721 e3abac25-378b-4346-85de-24260fe3988d

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