edje_entry: fix crash issue in case of no selection text 25/67525/2 accepted/tizen/common/20160428.144255 accepted/tizen/ivi/20160428.003048 accepted/tizen/mobile/20160428.005143 accepted/tizen/tv/20160428.002850 accepted/tizen/wearable/20160428.003215 submit/tizen/20160427.115643
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 27 Apr 2016 06:58:26 +0000 (15:58 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 27 Apr 2016 07:44:16 +0000 (16:44 +0900)
Change-Id: I90362a605cdaa10a64548003852e4448ba81c984

src/lib/edje/edje_entry.c

index c86057b..77051df 100644 (file)
@@ -4676,6 +4676,7 @@ _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UN
    Edje *ed = data;
    Edje_Real_Part *rp = ed->focused_part;
    Entry *en = NULL;
+   const char *selection_text = NULL;
 
    if (!rp) return EINA_FALSE;
    if ((rp->type != EDJE_RP_TYPE_TEXT) ||
@@ -4688,9 +4689,12 @@ _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UN
 
    if (en->have_selection)
      {
+        selection_text = _edje_entry_selection_get(rp);
+
         if (text)
-          *text = strdup(_edje_entry_selection_get(rp));
-        return EINA_TRUE;
+          *text = selection_text ? strdup(selection_text) : NULL;
+
+        return selection_text ? EINA_TRUE : EINA_FALSE;
      }
    else
      return EINA_FALSE;