Merge "Check if outputstream is open before writing data to it." into gingerbread
diff --git a/demokit/app/src/com/google/DemoKit/DemoKitActivity.java b/demokit/app/src/com/google/DemoKit/DemoKitActivity.java
index fb0473c..b9f3636 100644
--- a/demokit/app/src/com/google/DemoKit/DemoKitActivity.java
+++ b/demokit/app/src/com/google/DemoKit/DemoKitActivity.java
@@ -401,6 +401,9 @@
         };
 
     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+        if (mOutputStream == null)
+            return;
+
         byte[] buffer = new byte[3];
         if (progress > 255)
             progress = 255;
@@ -451,6 +454,9 @@
     }
 
     public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+        if (mOutputStream == null)
+            return;
+
         byte[] buffer = new byte[3];
         buffer[0] = 0x3;
         buffer[1] = -1;