1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(ime_pinyin): fix NULL pointer dereference

This commit is contained in:
Gabor Kiss-Vamosi 2023-05-01 10:17:03 +02:00
parent 9b5f7d91af
commit bcbf4292c6

View File

@ -774,6 +774,9 @@ static void lv_ime_pinyin_cand_panel_event(lv_event_t * e)
lv_ime_pinyin_t * pinyin_ime = (lv_ime_pinyin_t *)obj;
if(code == LV_EVENT_VALUE_CHANGED) {
lv_obj_t * ta = lv_keyboard_get_textarea(pinyin_ime->kb);
if(ta == NULL) return;
uint32_t id = lv_btnmatrix_get_selected_btn(cand_panel);
if(id == 0) {
pinyin_page_proc(obj, 0);
@ -785,7 +788,6 @@ static void lv_ime_pinyin_cand_panel_event(lv_event_t * e)
}
const char * txt = lv_btnmatrix_get_btn_text(cand_panel, id);
lv_obj_t * ta = lv_keyboard_get_textarea(pinyin_ime->kb);
uint16_t index = 0;
for(index = 0; index < pinyin_ime->ta_count; index++)
lv_textarea_del_char(ta);