Fix crash issue of app-defined-loader 89/294789/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 26 Jun 2023 22:11:55 +0000 (22:11 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 26 Jun 2023 22:11:55 +0000 (22:11 +0000)
The argument of Plugin::PrepareApp() should not be nullptr.
This patch modifies that the implementation of the Plugin::PrepareApp() allows
the empty string. If the argument is the empty string, the nullptr will be
passed to the plugin function.

Change-Id: I6bc62c496ab663965070af512b041928a98ec75e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/app-defined-loader/app-defined-loader.cc
src/lib/launchpad-glib/plugin.cc

index 8d621e1..92fff33 100644 (file)
@@ -150,7 +150,7 @@ class AppDefinedLoader {
     else if (loader_type == kLoaderTypeHw)
       setenv("AUL_HWACC", "hw", 1);
 
-    int ret = launchpad::Plugin::PrepareApp(nullptr, ex);
+    int ret = launchpad::Plugin::PrepareApp("", ex);
     if (ret != 0) {
       _E("Plugin::PrepareApp() is failed. error(%d)", ret);
       exit(EXIT_FAILURE);
index f9dfdd5..5caa740 100644 (file)
@@ -54,7 +54,8 @@ int Plugin::PrepareApp(const std::string& appid, const tizen_base::Bundle& b) {
   }
 
   _W("%s ++", kTagLaunchpadPluginPrepareApp);
-  int ret = prepare_app_func(appid.c_str(), b.GetHandle());
+  int ret = prepare_app_func(appid.empty() ? nullptr : appid.c_str(),
+      b.GetHandle());
   _W("%s --", kTagLaunchpadPluginPrepareApp);
   return ret;
 }