Ui text: add null checks for anchor update
authorDaniel Hirt <hirt.danny@gmail.com>
Tue, 19 Sep 2017 17:16:59 +0000 (20:16 +0300)
committerDaniel Hirt <hirt.danny@gmail.com>
Wed, 20 Sep 2017 06:19:33 +0000 (09:19 +0300)
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
src/lib/elementary/efl_ui_text.c

index 862c832..e7e70ed 100644 (file)
@@ -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
index 1875e72..da1442e 100644 (file)
@@ -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