fix(dropdown): in lv_dropdpwn_get_selected_str handle if there are no options (#2925)

* fix lv_dropdown_get_selected_str

* fix lv_dropdown_get_selected_str

* fix lv_dropdown_get_selected_str
This commit is contained in:
Paul
2021-12-20 15:57:03 +01:00
committed by GitHub
parent d2316447c5
commit 28d06b0354

View File

@@ -372,7 +372,15 @@ void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf
uint32_t i;
uint32_t line = 0;
size_t txt_len = strlen(dropdown->options);
size_t txt_len;
if(dropdown->options) {
txt_len = strlen(dropdown->options);
}
else {
buf[0] = '\0';
return;
}
for(i = 0; i < txt_len && line != dropdown->sel_opt_id_orig; i++) {
if(dropdown->options[i] == '\n') line++;