audiopolicy: fix null pointer being dereferenced in apm
Fix null pointer being dereferenced in apm.
Change-Id: Ibc2ec240c2da31a80ac087ed0f57661b10e97fb3
CRs-Fixed: 2444371
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 99f1a24..2806284 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1969,6 +1969,11 @@
audio_io_handle_t input = inputDesc->mIoHandle;
sp<RecordClientDescriptor> client = inputDesc->getClient(portId);
+ if (client == NULL) {
+ ALOGW("%s invalid client desc for %d", __FUNCTION__, portId);
+ return BAD_VALUE;
+ }
+
if (client->active()) {
ALOGW("%s input %d client %d already started", __FUNCTION__, input, client->portId());
return INVALID_OPERATION;