Add a missing exception handling 47/297147/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Aug 2023 03:31:50 +0000 (12:31 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Aug 2023 03:31:50 +0000 (12:31 +0900)
The Vconf::Get<T> can throw an exception. This patch adds an exception
handling to prevent a crash issue.

Change-Id: I96943d2e02b898bf07881d6327f303a923d4a2f7
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-process-pool/memory_monitor.cc

index ee6667f..d92de1f 100644 (file)
@@ -63,9 +63,13 @@ void MemoryMonitor::SetEventListener(MemoryMonitor::IEvent* listener) {
 }
 
 bool MemoryMonitor::IsLowMemory() {
-  if (low_vconf_.Get<int>() >=
-      Config::GetInst().GetMemoryStatus().GetLowValue())
-    return true;
+  try {
+    if (low_vconf_.Get<int>() >=
+        Config::GetInst().GetMemoryStatus().GetLowValue())
+      return true;
+  } catch (const Exception& e) {
+    _E("Exception occurs. error(%s)", e.what());
+  }
 
   if (threshold_ == 100)
     return false;