NULL Pointer Error after few clicks on list


Hi team,
When I click on the list, after few clicks it is showing NULL Pointer Error.

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


What do you experience?

I am using lists(Version 7) for my screen. After few clicks on list buttons, I am getting the following 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())

What do you expect?

I want to get the text of that list button whenever I click on that particular one.

Code to reproduce

 *      INCLUDES
#include "../../lv_examples.h"
#include <stdio.h>

 *      DEFINES

 *      TYPEDEFS

static void event_handler(lv_obj_t * obj, lv_event_t event);
lv_obj_t * button;
 *      MACROS


void iotgizmo_dimmer_list(void)

    lv_obj_t * wp = lv_img_create(lv_scr_act(), NULL);
    lv_img_set_src(wp, &white_bg);
    lv_obj_set_click(wp, true);
        static lv_point_t line_points[] = {{0,0},{480,0}};

        /*Create style*/
        static lv_style_t 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);

    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);

    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);

        button = lv_list_add_btn(list1, LV_SYMBOL_FILE, "aa4c34");
        lv_obj_set_event_cb(button, event_handler);

        button = lv_list_add_btn(list1, LV_SYMBOL_DIRECTORY, "22f66c");
        lv_obj_set_event_cb(button, event_handler);

        button = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, "232cbc");
        lv_obj_set_event_cb(button, event_handler);

        button = lv_list_add_btn(list1, LV_SYMBOL_EDIT, "22fea0");
        lv_obj_set_event_cb(button, event_handler);

        button = lv_list_add_btn(list1, LV_SYMBOL_SAVE, "aa4d18");
        lv_obj_set_event_cb(button, event_handler);

        button = lv_list_add_btn(list1, LV_SYMBOL_BELL, "2408c4");
        lv_obj_set_event_cb(button, event_handler);


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));

Screenshot and/or video

If possible, add screenshots and/or videos about the current issue.

Is it possible that you are out of memory? Try to increase LV_MEM_SIZE in lv_conf.h

Is Component config --> LVGL configuration --> Feature usage --> Enable the Animation in menuconfig turned on? Or, the LV_USE_ANIMATION flag set to 1 in lv_conf.h? The page/list widgets required that feature to work properly.

Is it possible that it’s ut of memory? Try increasing LV_MEM_SIZE.

No, it was not out of memory. By enabling animation feature, the NULL pointer crash went away without increasing the LV_MEM_SIZE.

LV_USE_ANIMATION flag is already set to 1 in lv_conf.h. But again getting the same NULL POINTER ERROR.

I increased LV_MEM_SIZE, but again getting the same NULL Pointer ERROR. As Toshi_Motoyama said,
LV_USE_ANIMATION flag is set to 1 in lv_conf.h. But still facing the same error.

Thank you