<rdar://problem/12446320> Fixing an issue with our Driver where setting an immediate output would not cause suppression of the final printout. This allows effective output redirection for Python commands

llvm-svn: 166058
diff --git a/lldb/tools/driver/IOChannel.cpp b/lldb/tools/driver/IOChannel.cpp
index b6d4224..ade07b0 100644
--- a/lldb/tools/driver/IOChannel.cpp
+++ b/lldb/tools/driver/IOChannel.cpp
@@ -528,7 +528,7 @@
 void
 IOChannel::OutWrite (const char *buffer, size_t len, bool asynchronous)
 {
-    if (len == 0)
+    if (len == 0 || buffer == NULL)
         return;
 
     // We're in the process of exiting -- IOChannel::Run() has already completed
@@ -552,7 +552,7 @@
 void
 IOChannel::ErrWrite (const char *buffer, size_t len, bool asynchronous)
 {
-    if (len == 0)
+    if (len == 0 || buffer == NULL)
         return;
 
     // Use the mutex to make sure OutWrite and ErrWrite do not interfere with each other's output.