Merge "ipc: Add null check before dereferencing agm client" into audio-platform-arintf.lnx.1.0.c10
diff --git a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
index 520a2af..9b2d1d0 100644
--- a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
@@ -451,6 +451,10 @@
         uint32_t num = (uint32_t) *num_aif_info;
         int ret = -EINVAL;
         android::sp<IAGM> agm_client = get_agm_server();
+
+        if (!agm_client) {
+            goto error_exit_fn;
+        }
         auto status = agm_client->ipc_agm_get_aif_info_list(num,[&](int32_t _ret,
                                             hidl_vec<AifInfo> aif_list_ret_hidl,
                                             uint32_t num_aif_info_hidl )
@@ -475,6 +479,7 @@
         }
         return ret;
     }
+error_exit_fn:
     return -EINVAL;
 }