Skip to content

Commit

Permalink
Fix possible nullptr dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
Master92 committed Nov 12, 2024
1 parent 3f0057e commit 71d3154
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ui/page_playback.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ static lv_obj_t *page_playback_create(lv_obj_t *parent, panel_arr_t *arr) {
}

static void show_pb_item(uint8_t pos, media_file_node_t *node) {
char fname[256];
const char * const label = node->label;
if (pb_ui[pos].state == ITEM_STATE_INVISIBLE) {
lv_obj_add_flag(pb_ui[pos]._img, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(pb_ui[pos]._label, LV_OBJ_FLAG_HIDDEN);
Expand All @@ -114,6 +112,12 @@ static void show_pb_item(uint8_t pos, media_file_node_t *node) {
return;
}

if (node == NULL) {
return;
}

char fname[256];
const char * const label = node->label;
lv_label_set_text(pb_ui[pos]._label, label);
lv_obj_clear_flag(pb_ui[pos]._label, LV_OBJ_FLAG_HIDDEN);

Expand Down

0 comments on commit 71d3154

Please sign in to comment.