diff --git a/src/themes/default/lv_theme_default.c b/src/themes/default/lv_theme_default.c index c055117359..dfaf96f8f6 100644 --- a/src/themes/default/lv_theme_default.c +++ b/src/themes/default/lv_theme_default.c @@ -745,6 +745,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) if(lv_obj_check_type(obj, &lv_obj_class)) { #if LV_USE_TABVIEW + lv_obj_t * grandparent = lv_obj_get_parent(parent); /*Tabview content area*/ if(lv_obj_check_type(parent, &lv_tabview_class) && lv_obj_get_child(parent, 1) == obj) { return; @@ -757,7 +758,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) return; } /*Tabview pages*/ - else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { + else if(grandparent && lv_obj_check_type(grandparent, &lv_tabview_class)) { lv_obj_add_style(obj, &theme->styles.pad_normal, 0); lv_obj_add_style(obj, &theme->styles.rotary_scroll, 0); lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR); diff --git a/src/themes/mono/lv_theme_mono.c b/src/themes/mono/lv_theme_mono.c index 67791edfcb..03b11dc361 100644 --- a/src/themes/mono/lv_theme_mono.c +++ b/src/themes/mono/lv_theme_mono.c @@ -271,12 +271,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) if(lv_obj_check_type(obj, &lv_obj_class)) { #if LV_USE_TABVIEW + lv_obj_t * grandparent = lv_obj_get_parent(parent); /*Tabview content area*/ if(lv_obj_check_type(parent, &lv_tabview_class)) { return; } /*Tabview pages*/ - else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { + else if(grandparent && lv_obj_check_type(grandparent, &lv_tabview_class)) { lv_obj_add_style(obj, &theme->styles.card, 0); lv_obj_add_style(obj, &theme->styles.no_radius, 0); lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR); diff --git a/src/themes/simple/lv_theme_simple.c b/src/themes/simple/lv_theme_simple.c index 38088ec26f..c15cedeeb1 100644 --- a/src/themes/simple/lv_theme_simple.c +++ b/src/themes/simple/lv_theme_simple.c @@ -232,13 +232,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) if(lv_obj_check_type(obj, &lv_obj_class)) { #if LV_USE_TABVIEW + lv_obj_t * grandparent = lv_obj_get_parent(parent); /*Tabview content area*/ if(lv_obj_check_type(parent, &lv_tabview_class)) { lv_obj_add_style(obj, &theme->styles.scr, 0); return; } /*Tabview pages*/ - else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { + else if(grandparent && lv_obj_check_type(grandparent, &lv_tabview_class)) { lv_obj_add_style(obj, &theme->styles.scr, 0); lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR); return;