From 3b46c05d95a87da8d76a308a19fdf07ee7c76ae5 Mon Sep 17 00:00:00 2001 From: Chen Chen Date: Mon, 14 Mar 2022 13:16:44 -0700 Subject: [PATCH] SpatialAudio: fix crashes in BluetoothAudioSession Bug: 224578221 Bug: 214615268 Test: build Change-Id: I0fd7e0887200e39dc996b0d84de421ec13897e94 --- bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 37ac9678e8..cdee520b11 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -431,7 +431,9 @@ void BluetoothAudioSession::ReportLowLatencyModeAllowedChanged(bool allowed) { std::shared_ptr callback = observer.second; LOG(INFO) << __func__ << " - allowed=" << (allowed ? " allowed" : " disallowed"); - callback->low_latency_mode_allowed_cb_(cookie, allowed); + if (callback->low_latency_mode_allowed_cb_ != nullptr) { + callback->low_latency_mode_allowed_cb_(cookie, allowed); + } } }