Check app status existence before insert 67/306767/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Feb 2024 10:14:32 +0000 (19:14 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Feb 2024 10:14:32 +0000 (19:14 +0900)
Before insert the app status, amd checks whether the app status exists or not.

Change-Id: If8c79a0cad2deaff4a3e17f30fe860674c391f12
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_status/app_status_manager.cc

index 7104580..ec6e054 100644 (file)
@@ -765,6 +765,14 @@ void AppStatusManager::RemovePackageStatus(const AppStatusPtr& app_status) {
 }
 
 void AppStatusManager::Insert(AppStatusPtr app_status) {
+  if (app_status == nullptr) return;
+
+  if (pid_map_.find(app_status->GetPID()) != pid_map_.end()) {
+    _E("Already exists. pid(%d), appid(%s)",
+        app_status->GetPID(), app_status->GetAppID().c_str());
+    return;
+  }
+
   if (!app_status->IsStarting())
     app_status->SetStartupTimer();