diff options
-rw-r--r-- | java/src/SOCKStream.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/java/src/SOCKStream.java b/java/src/SOCKStream.java index 079dcb05c3c..58498597e88 100644 --- a/java/src/SOCKStream.java +++ b/java/src/SOCKStream.java @@ -84,7 +84,7 @@ public class SOCKStream { // Get the data out String buf = s.toString (); - this.oStream_.print (buf); + this.oStream_.print(buf); this.oStream_.flush (); return buf.length (); } @@ -125,7 +125,10 @@ public class SOCKStream { String temp = this.iStream_.readLine (); s.append (temp); - return temp.length (); + if (temp == null) // Possible if user sends just a line feed, but + return -1; // not checking would cause a null ptr exception + else + return temp.length (); } /** |