herdsman pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=acd1c409a02026f550ac61d37573692dc6da680f

commit acd1c409a02026f550ac61d37573692dc6da680f
Author: Daniel Hirt <[email protected]>
Date:   Tue Sep 19 20:16:59 2017 +0300

    Ui text: add null checks for anchor update
    
    Add null checks in case item was not found.
    Also use one more emoticon to test the provider.
---
 src/bin/elementary/test_efl_ui_text.c |  2 +-
 src/lib/elementary/efl_ui_text.c      | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/bin/elementary/test_efl_ui_text.c 
b/src/bin/elementary/test_efl_ui_text.c
index 862c832e16..e7e70ed22d 100644
--- a/src/bin/elementary/test_efl_ui_text.c
+++ b/src/bin/elementary/test_efl_ui_text.c
@@ -117,7 +117,7 @@ my_efl_ui_text_bt_4(void *data, Evas_Object *obj 
EINA_UNUSED, void *event_info E
 {
    Evas_Object *en = data;
    efl_text_cursor_object_item_insert(en, efl_text_cursor_get(en, 
EFL_TEXT_CURSOR_GET_MAIN),
-         "size=32x32 href=emoticon");
+         "size=32x32 href=emoticon/evil-laugh");
 }
 
 static void
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index 1875e722a6..da1442e835 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -4805,6 +4805,8 @@ _item_obj_get(Anchor *an, Evas_Object *o, Evas_Object 
*smart, Evas_Object *clip)
    Eo *obj = an->obj;
    Evas_Object *item_obj;
 
+   if (!an->name) return NULL;
+
    EFL_UI_TEXT_DATA_GET(obj, sd);
 
    EINA_INLIST_FOREACH(sd->item_objs, io)
@@ -5089,12 +5091,16 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd)
                   an->sel = eina_list_append(an->sel, rect);
 
                   ob = _item_obj_get(an, o, smart, clip);
-                  rect->obj = ob;
 
-                  efl_text_object_item_geometry_get(an->obj,
-                           an->annotation, &cx, &cy, &cw, &ch);
-                  evas_object_move(rect->obj, x + cx, y + cy);
-                  evas_object_resize(rect->obj, cw, ch);
+                  if (ob)
+                    {
+                       rect->obj = ob;
+
+                       efl_text_object_item_geometry_get(an->obj,
+                             an->annotation, &cx, &cy, &cw, &ch);
+                       evas_object_move(rect->obj, x + cx, y + cy);
+                       evas_object_resize(rect->obj, cw, ch);
+                    }
                }
           }
         // for link anchors

-- 


Reply via email to