[Convergence] Return InvalidValuesError if id is empty. 14/101914/3
authorTomasz Marciniak <t.marciniak@samsung.com>
Fri, 2 Dec 2016 10:20:04 +0000 (19:20 +0900)
committerPiotr Kosko <p.kosko@samsung.com>
Mon, 5 Dec 2016 13:45:09 +0000 (14:45 +0100)
[Verification] Code compiles. Proper error is returned
in error callback.

Change-Id: I55c6c7fbb786022bdbe882bd9ee99cae0654242b
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
src/convergence/convergence_instance.cc

index 622d8505e2d3606f0957d82769c34623b97db685..4ad3807ba55fb9e29f3c98ff975e71fb906d3237 100644 (file)
@@ -359,9 +359,12 @@ common::TizenResult ConvergenceInstance::RemoteAppControlServiceLaunch(const pic
       result = LogAndCreateTizenError(AbortError, "Can not find the service type = 1",
         ("Can not find the service type = 1"));
     } else {
-      result = service->Launch(
-                  ConvergenceUtils::GetArg(args, kJSArgumentAppId).to_str().c_str(),
-                  static_cast<int>(ConvergenceUtils::GetArg(args, kJSCurrentListenerId).get<double>()));
+      std::string id = ConvergenceUtils::GetArg(args, kJSArgumentAppId).to_str();
+      if (id.empty()) {
+        result = LogAndCreateTizenError(InvalidValuesError, "Invalid app id", ("Invalid app id"));
+      } else {
+        result = service->Launch(id.c_str(), static_cast<int>(ConvergenceUtils::GetArg(args, kJSCurrentListenerId).get<double>()));
+      }
     }
 
     //only in case of failure call callback