diff options
author | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-19 20:16:59 +0300 |
---|---|---|
committer | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-20 09:19:33 +0300 |
commit | acd1c409a02026f550ac61d37573692dc6da680f (patch) | |
tree | d6e6c36fd632db67b70524865966caf627a5ef9c | |
parent | d44131a3aa220b6482b3eb62e207c8c05c10e02e (diff) |
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.
-rw-r--r-- | src/bin/elementary/test_efl_ui_text.c | 2 | ||||
-rw-r--r-- | 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 | |||
117 | { | 117 | { |
118 | Evas_Object *en = data; | 118 | Evas_Object *en = data; |
119 | efl_text_cursor_object_item_insert(en, efl_text_cursor_get(en, EFL_TEXT_CURSOR_GET_MAIN), | 119 | efl_text_cursor_object_item_insert(en, efl_text_cursor_get(en, EFL_TEXT_CURSOR_GET_MAIN), |
120 | "size=32x32 href=emoticon"); | 120 | "size=32x32 href=emoticon/evil-laugh"); |
121 | } | 121 | } |
122 | 122 | ||
123 | static void | 123 | 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) | |||
4805 | Eo *obj = an->obj; | 4805 | Eo *obj = an->obj; |
4806 | Evas_Object *item_obj; | 4806 | Evas_Object *item_obj; |
4807 | 4807 | ||
4808 | if (!an->name) return NULL; | ||
4809 | |||
4808 | EFL_UI_TEXT_DATA_GET(obj, sd); | 4810 | EFL_UI_TEXT_DATA_GET(obj, sd); |
4809 | 4811 | ||
4810 | EINA_INLIST_FOREACH(sd->item_objs, io) | 4812 | EINA_INLIST_FOREACH(sd->item_objs, io) |
@@ -5089,12 +5091,16 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd) | |||
5089 | an->sel = eina_list_append(an->sel, rect); | 5091 | an->sel = eina_list_append(an->sel, rect); |
5090 | 5092 | ||
5091 | ob = _item_obj_get(an, o, smart, clip); | 5093 | ob = _item_obj_get(an, o, smart, clip); |
5092 | rect->obj = ob; | ||
5093 | 5094 | ||
5094 | efl_text_object_item_geometry_get(an->obj, | 5095 | if (ob) |
5095 | an->annotation, &cx, &cy, &cw, &ch); | 5096 | { |
5096 | evas_object_move(rect->obj, x + cx, y + cy); | 5097 | rect->obj = ob; |
5097 | evas_object_resize(rect->obj, cw, ch); | 5098 | |
5099 | efl_text_object_item_geometry_get(an->obj, | ||
5100 | an->annotation, &cx, &cy, &cw, &ch); | ||
5101 | evas_object_move(rect->obj, x + cx, y + cy); | ||
5102 | evas_object_resize(rect->obj, cw, ch); | ||
5103 | } | ||
5098 | } | 5104 | } |
5099 | } | 5105 | } |
5100 | // for link anchors | 5106 | // for link anchors |