evas_main: add null check for safety

This commit is contained in:
WooHyun Jung 2020-04-14 08:49:42 +09:00
parent aee7d74b15
commit 3897603796
1 changed files with 12 additions and 4 deletions

View File

@ -123,20 +123,28 @@ _efl_gfx_image_load_error_to_evas_load_error(Eina_Error err)
static Eina_Content* static Eina_Content*
_markup_to_utf8(Eina_Content *from, const char *to_type) _markup_to_utf8(Eina_Content *from, const char *to_type)
{ {
Eina_Content *ret = NULL;
Eina_Slice slice = eina_content_data_get(from); Eina_Slice slice = eina_content_data_get(from);
char *utf8 = evas_textblock_text_markup_to_utf8(NULL, slice.mem); char *utf8 = evas_textblock_text_markup_to_utf8(NULL, slice.mem);
Eina_Content *ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(utf8), to_type); if (utf8)
free(utf8); {
ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(utf8), to_type);
free(utf8);
}
return ret; return ret;
} }
static Eina_Content* static Eina_Content*
_utf8_to_markup(Eina_Content *from, const char *to_type) _utf8_to_markup(Eina_Content *from, const char *to_type)
{ {
Eina_Content *ret = NULL;
Eina_Slice slice = eina_content_data_get(from); Eina_Slice slice = eina_content_data_get(from);
char *markup = evas_textblock_text_utf8_to_markup(NULL, slice.mem); char *markup = evas_textblock_text_utf8_to_markup(NULL, slice.mem);
Eina_Content *ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(markup), to_type); if (markup)
free(markup); {
ret = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(markup), to_type);
free(markup);
}
return ret; return ret;
} }