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)
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,
246 const char *off = text; 246 const char *off = text;
247 int len = 0; 247 int len = 0;
248 248
249 Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); 249 Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
250 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0);
250 evas_object_async_block(obj); 251 evas_object_async_block(obj);
251 252
252 while (*off) 253 while (*off)
@@ -412,7 +413,8 @@ _efl_text_cursor_range_delete(Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl
412EAPI void 413EAPI void
413efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle) 414efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
414{ 415{
415 Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS); 416 Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
417 EINA_SAFETY_ON_NULL_RETURN(pd);
416 if (handle == pd->handle) 418 if (handle == pd->handle)
417 return; 419 return;
418 420
@@ -429,7 +431,8 @@ efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
429EAPI Efl_Text_Cursor_Handle * 431EAPI Efl_Text_Cursor_Handle *
430efl_text_cursor_handle_get(const Eo *obj) 432efl_text_cursor_handle_get(const Eo *obj)
431{ 433{
432 Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS); 434 Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
435 EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
433 return pd->handle; 436 return pd->handle;
434} 437}
435 438
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
121 Efl_Text_Cursor_Handle cur; 121 Efl_Text_Cursor_Handle cur;
122 122
123 Eo *eo_obj = annotation->obj; 123 Eo *eo_obj = annotation->obj;
124 Evas_Object_Protected_Data *obj_data = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 124 Evas_Object_Protected_Data *obj_data = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
125 EINA_SAFETY_ON_NULL_RETURN_VAL(obj_data, EINA_FALSE);
125 evas_object_async_block(obj_data); 126 evas_object_async_block(obj_data);
126 _evas_textblock_relayout_if_needed(eo_obj); 127 _evas_textblock_relayout_if_needed(eo_obj);
127 128