Null point error

Description

Hi
When we are trying to redirect into another screen which contains list of items experiencing the null pointer error.
when running the devices list from main.c there is no error,but the same list of devices which are redirecting through another screen facing this null pointer error.

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

ARM

What do you experience?

When we are trying to redirect into another screen which contains list of items experiencing the null pointer error.
when running the devices list from main.c there is no error,but the same list of devices which are redirecting through another screen facing this null pointer error.

What do you expect?

try to resolve this null pointer error.

Code to reproduce

void iotgizmo_devices_list(const char *devicesList)
{
    printf("###Printing Device List:%s\n",devicesList);
  

#if LV_IOTGIZMO_WALLPAPER
    lv_obj_t * wp = lv_img_create(lv_scr_act(), NULL);
    lv_img_set_src(wp, &final_bg);
    lv_obj_set_click(wp, true);
#endif
    //style_bg
    static lv_style_t style_bg;
    lv_style_init(&style_bg);
    lv_style_set_bg_color(&style_bg,LV_STATE_DEFAULT, LV_COLOR_BG);
    lv_obj_add_style(lv_scr_act(),LV_OBJ_PART_MAIN, &style_bg);
    //style_list
    static lv_style_t style_list;
    lv_style_init(&style_list);
    lv_style_set_bg_color(&style_list,LV_STATE_DEFAULT, LV_COLOR_BG);
    lv_style_set_pad_top(&style_list,LV_STATE_DEFAULT,10);
    lv_style_set_pad_bottom(&style_list,LV_STATE_DEFAULT,10);
    lv_style_set_text_color(&style_list,LV_STATE_DEFAULT,LV_COLOR_WHITE);
    lv_style_set_text_font(&style_list, LV_STATE_DEFAULT, &roboto_regular_25);
    //style_title
    static lv_style_t style_title;
    lv_style_init(&style_title);
    lv_style_set_text_font(&style_title, LV_STATE_DEFAULT, &roboto_bold);
    lv_style_set_text_color(&style_title, LV_STATE_DEFAULT, LV_COLOR_WHITE);
        //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_text(label1, "iotGizmo Devices");
    lv_obj_set_width(label1, 150);
    lv_obj_add_style(label1, LV_LINE_PART_MAIN, &style_title);
    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);

    //list

    list_devices = lv_list_create(lv_scr_act(), NULL);
    lv_obj_set_size(list_devices, 480, 780);
    lv_list_set_scroll_propagation(list_devices, true);
    lv_obj_add_style(list_devices,LV_IMG_PART_MAIN,&style_list);
    lv_obj_align(list_devices, line1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);

    lv_obj_t * list_btn;
    list_btn = lv_list_add_btn(list_devices, NULL, arr[i]);
    lv_obj_set_event_cb(list_btn, event_handler);
}

could you help for this topic…

Sorry, that’s too less of information.
I don’t see when and how iotgizmo_devices_list is called, I don’t see what devicesList is good for.
I don’t see what the array arr is. I don’t see the (global?) variable i.

You should provide a minimum (stripped down) runnable example of your code so someone could
include it in own environment and do some investigation on it.

1 Like