Error redirecting to other screen

Description

Hi Team,
i am using containers in my code. when i click on container i am redirecting to other screen which contains small list. when i click on the container getting below error
Error: lv_obj_get_ext_attr (lv_obj.c #3174 lv_obj_get_ext_attr())
Error: NULL pointer (0x00000000) (lv_debug.c #127 lv_debug_log_error())
But when i run list screen individually i am not getting any errors

What MCU/Processor/Board and compiler are you using?

ARM

What LVGL version are you using?

Version 7

What do you want to achieve?

What have you tried so far?

Code to reproduce

containers file

/**
 * @file lv_iotgizmo_menu.c
 *
 */

 /*********************
  *      INCLUDES
  *********************/
#include "../../lv_examples.h"
#include "iotgizmo_menu.h"
#include "iotgizmo_dimmer_list.h"
#include "iotgizmo_thermostat_list.h"
#include "iotgizmo_switch_list.h"
#include <stdio.h>
#if LV_USE_IOTGIZMO

/*********************
*      DEFINES
*********************/

/**********************
*      TYPEDEFS
**********************/

/**********************
*  STATIC PROTOTYPES
**********************/

/**********************
*  STATIC VARIABLES
**********************/
static lv_style_t style_line;
static lv_style_t style_border;
static void dimmer_list(lv_obj_t * obj, lv_event_t event);
static void thermostat_list(lv_obj_t * obj, lv_event_t event);
static void switch_list(lv_obj_t * obj, lv_event_t event);
static void music_list(lv_obj_t * obj, lv_event_t event);
//msg box
static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt);
static void opa_anim(void * bg, lv_anim_value_t v);

static lv_obj_t *mbox, *info;
static lv_style_t style_modal;

#if LV_IOTGIZMO_WALLPAPER
LV_IMG_DECLARE(bg)
#endif
LV_IMG_DECLARE(bulb)
LV_IMG_DECLARE(temperature)
LV_IMG_DECLARE(switch_icon)
LV_IMG_DECLARE(music)
LV_IMG_DECLARE(home)
LV_IMG_DECLARE(microphone)
LV_IMG_DECLARE(lock)
LV_IMG_DECLARE(settings)
/**********************
 *      MACROS
**********************/

/**********************
*   GLOBAL FUNCTIONS
**********************/

void iotgizmo_menu(void)
{

    #if LV_IOTGIZMO_WALLPAPER
        lv_obj_t * wp = lv_img_create(lv_scr_act(), NULL);
        lv_img_set_src(wp, &bg);
    #endif
        //style_model
        lv_style_init(&style_modal);
            lv_style_set_bg_color(&style_modal, LV_STATE_DEFAULT, LV_COLOR_BLACK);
    //line
            static lv_point_t line_points[] = {{0,0},{480,0}};

            /*Create style*/
            //static lv_style_t style_line;
            lv_style_init(&style_line);
            lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 2);
            lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, LV_COLOR_GRAY);
            lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);

            lv_style_init(&style_border);
            lv_style_set_bg_color(&style_border,LV_STATE_DEFAULT,LV_COLOR_BLACK);
            lv_style_set_radius(&style_border, LV_STATE_DEFAULT, 30);


            //bulb container
            lv_obj_t * cont_bulb;
            cont_bulb = lv_cont_create(lv_scr_act(), NULL);
            lv_obj_set_auto_realign(cont_bulb, true);
            lv_obj_align_origo(cont_bulb, NULL, LV_ALIGN_IN_TOP_LEFT, 120, 200);
            lv_cont_set_fit(cont_bulb, LV_FIT_TIGHT);
            lv_cont_set_layout(cont_bulb, LV_LAYOUT_COLUMN_MID);
            lv_obj_add_style(cont_bulb,LV_OBJ_PART_MAIN,&style_border);
            lv_obj_set_event_cb(cont_bulb, dimmer_list);

            lv_obj_t * bulb_ic = lv_img_create(cont_bulb, NULL);
            lv_img_set_src(bulb_ic, &bulb);
            lv_obj_align(bulb_ic, NULL, LV_ALIGN_IN_TOP_LEFT, 50, 50);

            lv_obj_t * label1;
            label1 = lv_label_create(cont_bulb, NULL);
            lv_label_set_recolor(label1, true);
            lv_label_set_text(label1, "#FFFFFF BULB");
            lv_obj_set_width(label1, 150);

            //thermostat container
            lv_obj_t * cont_thermo;
            cont_thermo = lv_cont_create(lv_scr_act(), NULL);
            lv_obj_set_auto_realign(cont_thermo, true);
            lv_obj_align_origo(cont_thermo, NULL, LV_ALIGN_IN_TOP_RIGHT, -120, 200);
            lv_cont_set_fit(cont_thermo, LV_FIT_TIGHT);
            lv_cont_set_layout(cont_thermo, LV_LAYOUT_COLUMN_MID);
            lv_obj_add_style(cont_thermo,LV_OBJ_PART_MAIN,&style_border);
            lv_obj_set_event_cb(cont_thermo, thermostat_list);

            lv_obj_t * thermostat_ic = lv_img_create(cont_thermo, NULL);
            lv_img_set_src(thermostat_ic, &temperature);
            lv_obj_align(thermostat_ic, NULL, LV_ALIGN_IN_TOP_RIGHT, -50, 50);
            lv_obj_t * label2;
            label2 = lv_label_create(cont_thermo, NULL);
            lv_label_set_recolor(label2, true);
            lv_label_set_text(label2, "#FFFFFF THERMOSTAT");
            lv_obj_set_width(label2, 150);

            //switch container
            lv_obj_t * cont_switch;
            cont_switch = lv_cont_create(lv_scr_act(), NULL);
            lv_obj_set_auto_realign(cont_switch, true);
            lv_obj_align_origo(cont_switch,cont_bulb, LV_ALIGN_CENTER, 0, 300);
            lv_cont_set_fit(cont_switch, LV_FIT_TIGHT);
            lv_cont_set_layout(cont_switch, LV_LAYOUT_COLUMN_MID);
            lv_obj_add_style(cont_switch,LV_OBJ_PART_MAIN,&style_border);
            lv_obj_set_event_cb(cont_switch, switch_list);

            lv_obj_t * switch_ic = lv_img_create(cont_switch, NULL);
            lv_img_set_src(switch_ic, &switch_icon);

            lv_obj_t * label3;
            label3 = lv_label_create(cont_switch, NULL);
            lv_label_set_recolor(label3, true);
            lv_label_set_text(label3, "#FFFFFF SWITCH");
            lv_obj_set_width(label3, 150);

            //music
            lv_obj_t * cont_music;
            cont_music = lv_cont_create(lv_scr_act(), NULL);
            lv_obj_set_auto_realign(cont_music, true);
            lv_obj_align_origo(cont_music, cont_thermo, LV_ALIGN_CENTER, 0, 300);
            lv_cont_set_fit(cont_music, LV_FIT_TIGHT);
            lv_cont_set_layout(cont_music, LV_LAYOUT_COLUMN_MID);
            lv_obj_add_style(cont_music,LV_OBJ_PART_MAIN,&style_border);
            lv_obj_set_event_cb(cont_music, music_list);

            lv_obj_t * music_ic = lv_img_create(cont_music, NULL);
            lv_img_set_src(music_ic, &music);

            lv_obj_t * label4;
            label4 = lv_label_create(cont_music, NULL);
            lv_label_set_recolor(label4, true);
            lv_label_set_text(label4, "#FFFFFF MUSIC");
            lv_obj_set_width(label4, 150);

        //menu bar

        /*lv_obj_t * label5;
        label5 = lv_label_create(lv_scr_act(), NULL);
        lv_label_set_recolor(label5, true);
        lv_label_set_text(label5, "#FFFFFF Home");
        lv_obj_set_width(label5, 150);
        lv_obj_align(label5, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 40, -10);
        lv_obj_t * home_ic = lv_img_create(lv_scr_act(), NULL);
            lv_img_set_src(home_ic, &home);
            lv_obj_align(home_ic, label5, LV_ALIGN_OUT_TOP_MID, 0, -10);
            //line object
                            lv_obj_t * line1;
                            line1 = lv_line_create(lv_scr_act(), NULL);
                            lv_line_set_points(line1, line_points, 2);
                            lv_obj_add_style(line1, LV_LINE_PART_MAIN, &style_line);
                            lv_obj_align(line1, home_ic, LV_ALIGN_OUT_TOP_MID, 180, -30);
        lv_obj_t * microphone_ic = lv_img_create(lv_scr_act(), NULL);
           lv_img_set_src(microphone_ic, &microphone);
           lv_obj_align(microphone_ic, home_ic, LV_ALIGN_CENTER, 120, 0);
           lv_obj_t * label6;
           label6 = lv_label_create(lv_scr_act(), NULL);
           lv_label_set_recolor(label6, true);
           lv_label_set_text(label6, "#FFFFFF Alexa ON");
           lv_obj_set_width(label6, 150);
           lv_obj_align(label6, microphone_ic, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);

           lv_obj_t * settings_ic = lv_img_create(lv_scr_act(), NULL);
                  lv_img_set_src(settings_ic, &settings);
                  lv_obj_align(settings_ic, microphone_ic, LV_ALIGN_CENTER, 120, 0);
                  lv_obj_t * label7;
                  label7 = lv_label_create(lv_scr_act(), NULL);
                  lv_label_set_recolor(label7, true);
                  lv_label_set_text(label7, "#FFFFFF Settings");
                  lv_obj_set_width(label7, 150);
                  lv_obj_align(label7, settings_ic, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);

                  lv_obj_t * label8;
                  label8 = lv_label_create(lv_scr_act(), NULL);
                                              lv_label_set_recolor(label8, true);
                                              lv_label_set_text(label8, "#FFFFFF Lock");
                                              lv_obj_set_width(label8, 150);
                                              lv_obj_align(label8, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -40, -10);
                  lv_obj_t * lock_ic = lv_img_create(lv_scr_act(), NULL);
                                lv_img_set_src(lock_ic, &lock);
                                lv_obj_align(lock_ic, label8, LV_ALIGN_OUT_TOP_MID, 0, -10);*/


}

/**********************
*   STATIC FUNCTIONS
**********************/
static void switch_list(lv_obj_t * obj, lv_event_t event)
  {
            if(event == LV_EVENT_CLICKED) {
                printf("### Switch List\n");
                iotgizmo_switch_list();
     }
   }
#endif

list file

/**
 * @file iotgizmo_switch_list.c
 *
 */

/*********************
 *      INCLUDES
 *********************/
#include <lv_examples/src/iotGizmo/iotgizmo_switch_list.h>
#include "../../lv_examples.h"
#include <stdio.h>
#if LV_USE_IOTGIZMO

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

/**********************
 *  STATIC PROTOTYPES
 **********************/
static void event_handler(lv_obj_t * obj, lv_event_t event);
/**********************
 *  STATIC VARIABLES
 **********************/
lv_obj_t * button;
static lv_style_t style_line;
static lv_style_t style_label;
#if LV_IOTGIZMO_WALLPAPER
LV_IMG_DECLARE(bg)
#endif
LV_IMG_DECLARE(bulb)
LV_IMG_DECLARE(temperature)
LV_IMG_DECLARE(switch_icon)
LV_IMG_DECLARE(music)
LV_IMG_DECLARE(home)
LV_IMG_DECLARE(microphone)
LV_IMG_DECLARE(lock)
LV_IMG_DECLARE(settings)
/**********************
 *      MACROS
 **********************/

/**********************
 *   GLOBAL FUNCTIONS
 **********************/

void iotgizmo_switch_list(void)
{

#if LV_IOTGIZMO_WALLPAPER
    lv_obj_t * wp = lv_img_create(lv_scr_act(), NULL);
    lv_img_set_src(wp, &bg);
#endif
//line
        static lv_point_t line_points[] = {{0,0},{480,0}};

        /*Create style*/
        static lv_style_t style_line;
        lv_style_init(&style_line);
        lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 2);
        lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, LV_COLOR_GRAY);
        lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);


    lv_obj_t * label1;
    label1 = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_recolor(label1, true);
    lv_label_set_text(label1, "#FFFFFF Device List");
    lv_obj_set_width(label1, 150);
    lv_obj_align(label1, NULL, LV_ALIGN_IN_TOP_MID, 0, 30);

    //line object
    lv_obj_t * line1;
    line1 = lv_line_create(lv_scr_act(), NULL);
    lv_line_set_points(line1, line_points, 2);
    lv_obj_add_style(line1, LV_LINE_PART_MAIN, &style_line);
    lv_obj_align(line1, label1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);

    //page
    lv_obj_t * page = lv_page_create(lv_scr_act(), NULL);
        lv_obj_set_size(page, 480, 780);
        lv_obj_align(page, NULL, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
    //style_list
    static lv_style_t style_list;
    lv_style_init(&style_list);

    //list
    lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL);
    lv_obj_set_size(list1, 480, 780);
    lv_list_set_scroll_propagation(list1, true);
    lv_obj_set_width(list1, lv_page_get_width_fit(page));
    lv_obj_set_height(list1, lv_page_get_height_fit(page));
    lv_obj_align(list1, line1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);

    const char * txts[] = {LV_SYMBOL_EYE_OPEN,"04e4cc",LV_SYMBOL_EYE_OPEN,"04e4db",NULL};
            uint32_t i;
            for(i=0;txts[i]!=NULL;i+=2){
                 button=lv_list_add_btn(list1,txts[i],txts[i+1]);
                 lv_obj_set_event_cb(button, event_handler);
            }

}

/**********************
 *   STATIC FUNCTIONS
 **********************/
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
    if(event == LV_EVENT_CLICKED) {
        printf("Clicked: %s\n", lv_list_get_btn_text(obj));
    }
}
#endif

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.
Please help me with this.
Thanks in Advance.

You are probably calling an LVGL function with a null object.

can you please tell me how to resolve this.

If you have access to a debugger you can step through your code to find where the null pointer is coming from. Your code sample is quite complex so you are probably more familiar with how it works than I am. :slightly_smiling_face: