From 976c40503356d257451964f3f81fa8b9dee31b78 Mon Sep 17 00:00:00 2001 From: Shu Lei Date: Thu, 13 Dec 2007 01:49:15 +0000 Subject: [PATCH] fix the NPE. When the vm cannot connect to the debug client/service, it would not create the redirectOutputStream. Hence, no need to call redirectOutputStream.close() and BaseLib.restoreStandardOutput. --- .../luaj/debug/net/j2me/ClientConnectionTask.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java b/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java index ad266c27..e50a6847 100644 --- a/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java +++ b/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java @@ -93,12 +93,14 @@ public class ClientConnectionTask implements Runnable, DebugEventListener { debugSupport.disconnect(1); } finally { - try { - redirectOutputStream.close(); - } catch (IOException ignore) {} - - // restore the print output - BaseLib.restoreStandardOutput(); + if (redirectOutputStream != null) { + try { + redirectOutputStream.close(); + } catch (IOException ignore) {} + + // restore the print output + BaseLib.restoreStandardOutput(); + } dispose(); }