Issue:#IBFYPI

Description: null pointer protected
Sig: SIG_ApplicaitonFramework
Feature or Bugfix: Bugfix
Binary Source: No
Signed-off-by: renjie84  renjie84@huawei.com

Signed-off-by: 任杰 <renjie84@huawei.com>
This commit is contained in:
任杰
2025-01-06 15:57:51 +08:00
parent aa83319c36
commit b3574ff939
2 changed files with 13 additions and 0 deletions
@@ -50,6 +50,9 @@ namespace OHOS {
ManagerService::ManagerService()
{
installer_ = new (std::nothrow) BundleInstaller(INSTALL_PATH, DATA_PATH);
if (installer_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_APP, "BundleMS BundleInstaller is nullptr");
}
bundleMap_ = BundleMap::GetInstance();
}
@@ -183,6 +186,10 @@ void ManagerService::ServiceMsgProcess(Request* request)
if (installer_ == nullptr) {
installer_ = new (std::nothrow) BundleInstaller(INSTALL_PATH, DATA_PATH);
if (installer_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_APP, "BundleMS BundleInstaller is nullptr");
return;
}
}
switch (request->msgId) {
+6
View File
@@ -35,6 +35,9 @@ public:
List() : count_(0)
{
head_ = new (std::nothrow) Node<T>();
if (head_ == nullptr) {
return;
}
head_->next_ = head_;
head_->prev_ = head_;
}
@@ -94,6 +97,9 @@ public:
void PushBack(T value)
{
auto node = new (std::nothrow) Node<T>(value);
if (node == nullptr) {
return;
}
node->next_ = head_;
node->prev_ = head_->prev_;