audio: check for USB device state when opening in/out stream

Check for USB headset device state when opening in/out stream,
and report error if USB headset is not in connected state. That's
to handle error condition gracefully to avoid further crashes in
audio flinger.

Change-Id: Ib33489fec00ac0b5c500fc1fa2dbeb021b51cbef
CRs-Fixed: 2261252
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c
index 2af255b..5f85f3b 100644
--- a/hal/audio_extn/usb.c
+++ b/hal/audio_extn/usb.c
@@ -1157,7 +1157,7 @@
     struct usb_card_config *usb_card_info;
     bool usb_connected = false;
 
-    if (str_parms_get_int(parms, "card", &card) >= 0) {
+    if ((parms != NULL) && str_parms_get_int(parms, "card", &card) >= 0) {
         usb_connected = audio_extn_usb_alive(card);
     } else {
         list_for_each(node_i, &usbmod->usb_card_conf_list) {