Fix static analysis issues 07/288707/1
authorChanggyu Choi <changyu.choi@samsung.com>
Wed, 22 Feb 2023 02:28:10 +0000 (11:28 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Wed, 22 Feb 2023 02:28:10 +0000 (11:28 +0900)
Add to check whether err is nullptr or not.

Change-Id: Ie21ba4836914da458ae80d6b11f0462079e43351
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
tizen-cpp/app-core-cpp/app_core_base.cc

index ad7aa52..5e8803a 100644 (file)
@@ -365,8 +365,10 @@ void AppCoreBase::Impl::InitSuspendDbusHandler(gpointer data) {
     GError* err = nullptr;
     __bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
     if (__bus == nullptr) {
-      _E("Failed to connect to the D-BUS daemon: %s", err->message);
-      g_error_free(err);
+      _E("Failed to connect to the D-BUS daemon: %s", err ? err->message : "");
+      if (err)
+        g_error_free(err);
+
       return;
     }
   }