[vlma-devel] commit: Avoid NullPointerExceptions. (Adrien Grand )

git version control git at videolan.org
Thu Feb 5 02:56:51 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Thu Feb  5 02:56:27 2009 +0100| [ee183876f7ba62241953c9abc26791a89bb615df] | committer: Adrien Grand 

Avoid NullPointerExceptions.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=ee183876f7ba62241953c9abc26791a89bb615df
---

 .../vlma/order/sender/TelnetConnection.java        |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/sender/TelnetConnection.java b/vlma-core/src/main/java/org/videolan/vlma/order/sender/TelnetConnection.java
index 814bc42..ec9f577 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/sender/TelnetConnection.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/sender/TelnetConnection.java
@@ -58,11 +58,18 @@ public class TelnetConnection {
     }
 
     public void close() throws IOException {
-        out.close();
-        out = null;
-        in.close();
-        in = null;
-        socket.close();
+        if (out != null) {
+            out.close();
+            out = null;
+        }
+        if (in != null) {
+            in.close();
+            in = null;
+        }
+        if (socket != null) {
+            socket.close();
+            socket = null;
+        }
     }
 
     public void println(String line) {



More information about the vlma-devel mailing list