fix crash when text area cleared. Fixes #1556

This commit is contained in:
Gabor Kiss-Vamosi
2020-06-04 11:47:25 +02:00
parent 93055bc57c
commit 7d29b40425

View File

@@ -571,10 +571,17 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t char_id, lv_point_
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_NULL(pos);
const char * txt = lv_label_get_text(label);
if(txt[0] == '\0') {
pos->x = 0;
pos->y = 0;
return;
}
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;