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.
This commit is contained in:
Daniel Hirt 2017-09-19 20:16:59 +03:00
parent d44131a3aa
commit acd1c409a0
2 changed files with 12 additions and 6 deletions

View 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

View 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