Fix issue 4368520: crash in bluez audio at boot

Added missing initialization of output stream pointer in
device struct and test on valid output stream in set_parameters()

Change-Id: I162c410968dcbd6ed89f939c42bd48dbfe390a71
diff --git a/audio/android_audio_hw.c b/audio/android_audio_hw.c
index 90bb72e..63c7bb9 100644
--- a/audio/android_audio_hw.c
+++ b/audio/android_audio_hw.c
@@ -546,13 +546,15 @@
                             sizeof(value));
     if (ret >= 0) {
         adev->bt_enabled = !strcmp(value, "true");
-        _out_bt_enable(adev->output, adev->bt_enabled);
+        if (adev->output)
+            _out_bt_enable(adev->output, adev->bt_enabled);
     }
 
     ret = str_parms_get_str(parms, A2DP_SUSPENDED_PARM, value, sizeof(value));
     if (ret >= 0) {
         adev->suspended = !strcmp(value, "true");
-        _out_a2dp_suspend(adev->output, adev->suspended);
+        if (adev->output)
+            _out_a2dp_suspend(adev->output, adev->suspended);
     }
 
     pthread_mutex_unlock(&adev->lock);
@@ -688,7 +690,9 @@
         return -ENOMEM;
 
     adev->bt_enabled = true;
+    adev->suspended = false;
     pthread_mutex_init(&adev->lock, NULL);
+    adev->output = NULL;
 
     adev->device.common.tag = HARDWARE_DEVICE_TAG;
     adev->device.common.version = 0;