summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorali <ali198724@gmail.com>2020-01-02 12:52:22 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-02 12:53:20 +0100
commit87e5907f18dee96c9e93a41f7a611aa362039813 (patch)
tree92af80218a39ce3dd43b136deef13209dd99d1e3
parent4e6fd08306702784e9f8f12f2f278c6567c52dcc (diff)
downloadefl-87e5907f18dee96c9e93a41f7a611aa362039813.tar.gz
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
-rw-r--r--src/lib/evas/canvas/efl_text_cursor.c9
-rw-r--r--src/lib/evas/canvas/efl_text_formatter.c3
2 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/evas/canvas/efl_text_cursor.c b/src/lib/evas/canvas/efl_text_cursor.c
index b52298c1c0..eb699728b8 100644
--- a/src/lib/evas/canvas/efl_text_cursor.c
+++ b/src/lib/evas/canvas/efl_text_cursor.c
@@ -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;
}
diff --git a/src/lib/evas/canvas/efl_text_formatter.c b/src/lib/evas/canvas/efl_text_formatter.c
index 8325245cd2..aea3e42356 100644
--- a/src/lib/evas/canvas/efl_text_formatter.c
+++ b/src/lib/evas/canvas/efl_text_formatter.c
@@ -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);