diff --git a/services/common/src/bundle_active_core.cpp b/services/common/src/bundle_active_core.cpp index 35f26779dc3cf26ce78b738267f90ec3c222c495..38f9eee16973638e407301feff791a10a2958d94 100644 --- a/services/common/src/bundle_active_core.cpp +++ b/services/common/src/bundle_active_core.cpp @@ -546,6 +546,10 @@ void BundleActiveCore::OnUserRemoved(const int32_t userId) if (it == userStatServices_.end()) { return; } + if (userId < 0) { + BUNDLE_ACTIVE_LOGE("error userId %{public}d", userId); + return 0; + } userStatServices_[userId]->OnUserRemoved(); userStatServices_[userId].reset(); userStatServices_.erase(userId);