efl.text: add null check for cursor and attribute internal methods

Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike

Reviewed By: bu5hm4n

Subscribers: ProhtMeyhet, cedric, #reviewers, #committers

Tags: #efl

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10899
This commit is contained in:
Ali Alzyod 2020-01-02 12:52:22 +01:00 committed by Marcel Hollerbach
parent 4e6fd08306
commit 87e5907f18
2 changed files with 8 additions and 4 deletions

View File

@ -246,7 +246,8 @@ _cursor_text_append(Efl_Text_Cursor_Handle *cur,
const char *off = text;
int len = 0;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0);
evas_object_async_block(obj);
while (*off)
@ -412,7 +413,8 @@ _efl_text_cursor_range_delete(Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl
EAPI void
efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
{
Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN(pd);
if (handle == pd->handle)
return;
@ -429,7 +431,8 @@ efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
EAPI Efl_Text_Cursor_Handle *
efl_text_cursor_handle_get(const Eo *obj)
{
Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
return pd->handle;
}

View File

@ -121,7 +121,8 @@ efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation
Efl_Text_Cursor_Handle cur;
Eo *eo_obj = annotation->obj;
Evas_Object_Protected_Data *obj_data = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *obj_data = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(obj_data, EINA_FALSE);
evas_object_async_block(obj_data);
_evas_textblock_relayout_if_needed(eo_obj);