1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

Fixed lv_dropdown_add_option with default static options

This commit is contained in:
xennex22 2020-03-11 03:30:56 -07:00 committed by GitHub
parent 1023909acd
commit bcbcb6f31d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,8 +262,11 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
/*Can not append to static options*/
if(ext->static_txt != 0) return;
/*Clear any existing static options*/
if(ext->static_txt != 0) {
ext->options = NULL;
ext->static_txt = 0;
}
/*Allocate space for the new option*/
size_t old_len = (ext->options == NULL) ? 0 : strlen(ext->options);