diff --git a/services/accesstokenmanager/main/cpp/src/callback/callback_manager.cpp b/services/accesstokenmanager/main/cpp/src/callback/callback_manager.cpp index fdf1381eda28b1c85ab8773bd9298cd8bd913bd9..cfa63595d9429d80af61d29fe61d48d2ed704298 100644 --- a/services/accesstokenmanager/main/cpp/src/callback/callback_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/callback/callback_manager.cpp @@ -69,7 +69,8 @@ int32_t CallbackManager::AddCallback(const PermStateChangeScope& scopeRes, const LOGE(ATM_DOMAIN, ATM_TAG, "Callback size has reached limitation"); return AccessTokenError::ERR_CALLBACKS_EXCEED_LIMITATION; } - if (callback->IsProxyObject() && !callback->AddDeathRecipient(callbackDeathRecipient_)) { + if (callback->IsProxyObject() && + ((callbackDeathRecipient_ == nullptr) || !callback->AddDeathRecipient(callbackDeathRecipient_))) { LOGE(ATM_DOMAIN, ATM_TAG, "add death recipient failed"); return AccessTokenError::ERR_ADD_DEATH_RECIPIENT_FAILED; } diff --git a/services/privacymanager/src/active/active_status_callback_manager.cpp b/services/privacymanager/src/active/active_status_callback_manager.cpp index 214eba50ffae787f74f9a2a3870effa6c515d845..be5abafd0a952c119e8b6aeebcf352244c602294 100644 --- a/services/privacymanager/src/active/active_status_callback_manager.cpp +++ b/services/privacymanager/src/active/active_status_callback_manager.cpp @@ -76,7 +76,8 @@ int32_t ActiveStatusCallbackManager::AddCallback( LOGE(PRI_DOMAIN, PRI_TAG, "List size has reached max value"); return PrivacyError::ERR_CALLBACKS_EXCEED_LIMITATION; } - if (callback->IsProxyObject() && !callback->AddDeathRecipient(callbackDeathRecipient_)) { + if (callback->IsProxyObject() && + ((callbackDeathRecipient_ == nullptr) || !callback->AddDeathRecipient(callbackDeathRecipient_))) { LOGE(PRI_DOMAIN, PRI_TAG, "add death recipient failed"); return PrivacyError::ERR_ADD_DEATH_RECIPIENT_FAILED; }