fix(display): check NULL act_screen before using it (#4973)
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com> Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
15
tests/src/test_cases/test_screen_load.c
Normal file
15
tests/src/test_cases/test_screen_load.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
void test_screen_load_no_crash(void)
|
||||
{
|
||||
/*Delete active screen and load new screen should not crash*/
|
||||
lv_obj_t * screen = lv_screen_active();
|
||||
lv_obj_del(screen);
|
||||
screen = lv_obj_create(NULL);
|
||||
lv_screen_load(screen);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user