A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

[Bugfix] plugins printcell_helper crash on NULL pointer

printcell_set_columns() can take a NULL pointer for the *pcs
it then uses default settings but those were contained within
the scope of the if(NULL) check.

Change-Id: I3147d1f4e3954fdcdb3adb74713f4c8a9a2c08ec

authored by

William Wilgus and committed by
William Wilgus
c8ba67fa c3fd32bd

+18 -15
+18 -15
apps/plugins/lib/printcell_helper.c
··· 530 530 if (title == NULL) 531 531 title = "$PRINTCELL NOT SETUP"; 532 532 533 + uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /* starting position of column in title string */ 534 + int width, height, user_minwidth; 535 + int i = 0; 536 + size_t j = 0; 537 + rb->memset(&printcell, 0, sizeof(struct printcell_info_t)); 538 + 533 539 if (pcs == NULL) /* DEFAULTS */ 534 540 { 535 541 #if LCD_DEPTH > 1 ··· 538 544 #else 539 545 bool sep = (rb->global_settings->cursor_style == 0); 540 546 #endif 541 - pcs = &(struct printcell_settings){ .cell_separator = sep, 542 - .title_delimeter = '$', 543 - .text_delimeter = '$', 544 - .hidecol_flags = 0}; 547 + printcell.separator = sep; 548 + printcell.titlesep = '$'; 549 + printcell.colsep = '$'; 550 + printcell.hidecol_flags = 0; 551 + } 552 + else 553 + { 554 + printcell.separator = pcs->cell_separator; 555 + printcell.titlesep = pcs->title_delimeter; 556 + printcell.colsep = pcs->text_delimeter; 557 + printcell.hidecol_flags = pcs->hidecol_flags; 545 558 } 546 - 547 - uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /* starting position of column in title string */ 548 - int width, height, user_minwidth; 549 - int i = 0; 550 - size_t j = 0; 551 - rb->memset(&printcell, 0, sizeof(struct printcell_info_t)); 552 - 553 559 printcell.gui_list = gui_list; 554 - printcell.separator = pcs->cell_separator; 555 - printcell.titlesep = pcs->title_delimeter; 556 - printcell.colsep = pcs->text_delimeter; 557 - printcell.hidecol_flags = pcs->hidecol_flags; 560 + 558 561 559 562 int ch = printcell.titlesep; /* first column $ is optional */ 560 563