Exception while drawing empty dropdown box

If a dropdown box is not filled with options the draw function will cause an exception.
I create a dropdown, and fill it later depending on user request. How ever when there is no data in the dropdown an exception is happening in lv_dropdown_get_selected_string
in size_t txt_len = strlen(dropdown->options);

d_samplerate = lv_dropdown_create(o_tab);
lv_obj_align(d_samplerate, LV_ALIGN_TOP_LEFT, 0, y_margin + ibutton_y * button_height_margin);
lv_dropdown_clear_options(d_samplerate);
lv_obj_add_event_cb(d_samplerate, samplerate_button_handler, LV_EVENT_VALUE_CHANGED, NULL);

fixed the issue by checking for nullptr

void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size)
{
LV_ASSERT_OBJ(obj, MY_CLASS);

lv_dropdown_t * dropdown = (lv_dropdown_t *)obj;

uint32_t i;
uint32_t line        = 0;
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++;
}

uint32_t c;
for(c = 0; i < txt_len && dropdown->options[i] != '\n'; c++, i++) {
    if(buf_size && c >= buf_size - 1) {
        LV_LOG_WARN("lv_dropdown_get_selected_str: the buffer was too small");
        break;
    }
    buf[c] = dropdown->options[i];
}

buf[c] = '\0';

}