Evas textblock: Fix crash when cutting ligatures with formats.

"f<color=#f00>i</color>f" could cause textblock to crash. It doesn't
crash anymore. It doesn't render the colours correctly either, but at
least this is the first step.

This is the start of fixing T1308

@bugfix
This commit is contained in:
Tom Hacohen 2014-06-04 10:14:24 +01:00
parent 21e7a3aed9
commit 3b70b4f28f
2 changed files with 7 additions and 0 deletions

View File

@ -180,6 +180,10 @@ evas_common_text_props_index_find(const Evas_Text_Props *props, int _cutoff)
int max = props->len - 1;
int mid;
/* Props can be empty, verify they are not before going on. */
if (!props->info)
return -1;
_cutoff += props->text_offset;
ot_info = props->info->ot + props->start;
/* Should get us closer to the right place. */

View File

@ -2612,6 +2612,9 @@ START_TEST(evas_textblock_formats)
evas_object_textblock_text_markup_prepend(cur, "<b></b>");
ck_assert_str_eq(evas_object_textblock_text_markup_get(tb), "ab<b></b>c<br/>def");
/* Ligatures cut by formats */
evas_object_textblock_text_markup_set(tb, "f<color=#f00>i</color>f");
evas_object_textblock_size_formatted_get(tb, NULL, NULL);
END_TB_TEST();
}