fix(lv_textarea) fix crash while delete non-ascii character in pwd mode (#2549)

This commit is contained in:
Liming Du
2021-09-15 19:58:25 +08:00
committed by GitHub
parent fb7ea10401
commit 71e6f65d51

View File

@@ -259,8 +259,7 @@ void lv_textarea_del_char(lv_obj_t * obj)
}
if(ta->pwd_mode != 0) {
uint32_t byte_pos = _lv_txt_encoded_get_byte_id(ta->pwd_tmp, ta->cursor.pos - 1);
_lv_txt_cut(ta->pwd_tmp, ta->cursor.pos - 1, _lv_txt_encoded_size(&ta->pwd_tmp[byte_pos]));
_lv_txt_cut(ta->pwd_tmp, ta->cursor.pos - 1, 1);
ta->pwd_tmp = lv_mem_realloc(ta->pwd_tmp, strlen(ta->pwd_tmp) + 1);
LV_ASSERT_MALLOC(ta->pwd_tmp);