Fix editable context bug 95/208295/1
authorhyunho <hhstark.kang@samsung.com>
Fri, 21 Jun 2019 07:37:36 +0000 (16:37 +0900)
committerhyunho <hhstark.kang@samsung.com>
Fri, 21 Jun 2019 07:37:36 +0000 (16:37 +0900)
Change-Id: I65c92d23b89e0dd26ba7d463b49c71040bcec243
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watchface-complication/editables-container.cc

index 02699e0..e191d2f 100644 (file)
@@ -96,7 +96,7 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
       util::GetCmdStr(util::EditableEditPreview)) == 0) {
     int editable_id;
     int selected_idx;
-    char* context = NULL;
+    char* context = nullptr;
 
     if (sender_name_.compare(sender_name) != 0) {
       LOGE("invalid sender_name %s", sender_name.c_str());
@@ -108,14 +108,15 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
         editable_id);
 
     unique_ptr<Bundle> ctx_ptr;
-    if (context != NULL) {
-      std::string ctx_str = std::string(context);
+    std::string ctx_str = std::string(context);
+    if (!ctx_str.empty()) {
       ctx_ptr = std::unique_ptr<Bundle>(new (std::nothrow) Bundle(ctx_str));
       if (ctx_ptr.get() == nullptr) {
-        LOGE("Out of memory");
+        LOGE("Fail to create bundle");
         return;
       }
     }
+
     for (auto& i : ed_list_) {
       if (i.get()->GetEditableId() == editable_id) {
         i.get()->SetState(IEditable::OnGoing);