pal: fix null pointer dereference issue during cts
Add null check for rxAifBackEnds to avoid null pointer exception
during the CtsMediaAudioTestCases run.
Change-Id: I61fba15ed21e0010463541bc2af3ebf711cad4cd
diff --git a/session/src/SessionAlsaPcm.cpp b/session/src/SessionAlsaPcm.cpp
index efd5284..4f7331d 100644
--- a/session/src/SessionAlsaPcm.cpp
+++ b/session/src/SessionAlsaPcm.cpp
@@ -2404,8 +2404,10 @@
{
pal_param_device_rotation_t *rotation =
(pal_param_device_rotation_t *)payload;
- status = handleDeviceRotation(streamHandle, rotation->rotation_type,
- device, mixer, builder, rxAifBackEnds);
+ if (!rxAifBackEnds.empty()) {
+ status = handleDeviceRotation(streamHandle, rotation->rotation_type,
+ device, mixer, builder, rxAifBackEnds);
+ }
goto exit;
}
case PAL_PARAM_ID_LOAD_SOUND_MODEL: