widget: fix seg fault when ts is NULL.
authorAmitesh Singh <amitesh.sh@samsung.com>
Sun, 19 Oct 2014 05:55:02 +0000 (14:55 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Sun, 19 Oct 2014 05:56:15 +0000 (14:56 +0900)
Summary:
if translatable is FALSE and _translate_string_data_get returns NULL, ts
would be NULL which results into crash.

@fix

Reviewers: seoz, raster, Hermet

Reviewed By: Hermet

Subscribers: seoz

Differential Revision: https://phab.enlightenment.org/D1543

src/lib/elm_widget.c

index ab312b9..adf68df 100644 (file)
@@ -3218,16 +3218,13 @@ _part_text_translatable_set(Eina_Inlist **translate_strings, const char *part, E
      }
    //Delete this exist one if this part has been not preset.
    //see elm_widget_part_text_translatable_set()
-   else if ((preset) || (!ts->preset))
+   else if (ts && ((preset) || (!ts->preset)))
      {
-        if (ts)
-          {
-             t = eina_inlist_remove(t, EINA_INLIST_GET(ts));
-             eina_stringshare_del(ts->id);
-             eina_stringshare_del(ts->domain);
-             eina_stringshare_del(ts->string);
-             ELM_SAFE_FREE(ts, free);
-          }
+        t = eina_inlist_remove(t, EINA_INLIST_GET(ts));
+        eina_stringshare_del(ts->id);
+        eina_stringshare_del(ts->domain);
+        eina_stringshare_del(ts->string);
+        ELM_SAFE_FREE(ts, free);
      }
 
    *translate_strings = t;