diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd3715859..22fe7c57a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bugfixes - fix(cpicker) fix division by zero +- fix(dropdown) fix selecting options after the last one ## v7.9.0 (Plann1d at 05.01.2020 diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index 60f78d52cc..31eae45890 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -1298,6 +1298,7 @@ static void page_press_handler(lv_obj_t * page) static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t y) { + lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_obj_t * label = get_label(ddlist); if(label == NULL) return 0; y -= label->coords.y1; @@ -1311,6 +1312,7 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t y) uint16_t opt = y / h; + if(opt >= ext->option_cnt) opt = ext->option_cnt - 1; return opt; }