hal: handle null primary output scenario
Handle NULL primary output scenario to avoid crash.
CRs-Fixed: 2782413
Change-Id: I4c1ba663bb21583b6fa76d68461d5e16248aec90
diff --git a/hal/voice.c b/hal/voice.c
index 72c3372..586247f 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -231,6 +231,11 @@
return -EINVAL;
}
+ if (!adev->current_call_output) {
+ ALOGE("start_call: invalid current call output");
+ return -EINVAL;
+ }
+
uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
if (!uc_info) {
ALOGE("start_call: couldn't allocate mem for audio_usecase");