From 7c1a36d4ff7eb709d82c7f4808b2e128ca0b62e5 Mon Sep 17 00:00:00 2001 From: heyabinghyb Date: Mon, 28 Jul 2025 18:54:17 +0800 Subject: [PATCH] checknull Signed-off-by: heyabinghyb --- .../server/domain/device/src/audio_device_common.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/audio_policy/server/domain/device/src/audio_device_common.cpp b/services/audio_policy/server/domain/device/src/audio_device_common.cpp index ac12e5dd1c..45b5826ca3 100644 --- a/services/audio_policy/server/domain/device/src/audio_device_common.cpp +++ b/services/audio_policy/server/domain/device/src/audio_device_common.cpp @@ -207,6 +207,10 @@ std::vector> AudioDeviceCommon::GetPrefer if (networkId == LOCAL_NETWORK_ID) { std::shared_ptr desc = audioRouterCenter_.FetchInputDevice(captureInfo.sourceType, -1); + if (desc == nullptr) { + AUDIO_ERR_LOG("desc is nullptr"); + return {}; + } if (desc->deviceType_ == DEVICE_TYPE_NONE && (captureInfo.sourceType == SOURCE_TYPE_PLAYBACK_CAPTURE || captureInfo.sourceType == SOURCE_TYPE_REMOTE_CAST)) { desc->deviceType_ = DEVICE_TYPE_INVALID; -- Gitee