fix(demo): added gaurd to prevent crash if default theme is not used (#3257)

This commit is contained in:
Jason Peterson
2022-04-11 04:44:53 -06:00
committed by GitHub
parent 0b5a1d4b23
commit e19410f8f8

View File

@@ -1064,9 +1064,9 @@ static void color_event_cb(lv_event_t * e)
lv_palette_t * palette_primary = lv_event_get_user_data(e);
lv_palette_t palette_secondary = (*palette_primary) + 3; /*Use another palette as secondary*/
if(palette_secondary >= _LV_PALETTE_LAST) palette_secondary = 0;
#if LV_USE_THEME_DEFAULT
lv_theme_default_init(NULL, lv_palette_main(*palette_primary), lv_palette_main(palette_secondary), LV_THEME_DEFAULT_DARK, font_normal);
#endif
lv_color_t color = lv_palette_main(*palette_primary);
lv_style_set_text_color(&style_icon, color);
lv_chart_set_series_color(chart1, ser1, color);