mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
[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
This commit is contained in:
parent
c3fd32bdf2
commit
c8ba67fa7d
1 changed files with 18 additions and 15 deletions
|
@ -530,6 +530,12 @@ int printcell_set_columns(struct gui_synclist *gui_list,
|
||||||
if (title == NULL)
|
if (title == NULL)
|
||||||
title = "$PRINTCELL NOT SETUP";
|
title = "$PRINTCELL NOT SETUP";
|
||||||
|
|
||||||
|
uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /* starting position of column in title string */
|
||||||
|
int width, height, user_minwidth;
|
||||||
|
int i = 0;
|
||||||
|
size_t j = 0;
|
||||||
|
rb->memset(&printcell, 0, sizeof(struct printcell_info_t));
|
||||||
|
|
||||||
if (pcs == NULL) /* DEFAULTS */
|
if (pcs == NULL) /* DEFAULTS */
|
||||||
{
|
{
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
|
@ -538,23 +544,20 @@ int printcell_set_columns(struct gui_synclist *gui_list,
|
||||||
#else
|
#else
|
||||||
bool sep = (rb->global_settings->cursor_style == 0);
|
bool sep = (rb->global_settings->cursor_style == 0);
|
||||||
#endif
|
#endif
|
||||||
pcs = &(struct printcell_settings){ .cell_separator = sep,
|
printcell.separator = sep;
|
||||||
.title_delimeter = '$',
|
printcell.titlesep = '$';
|
||||||
.text_delimeter = '$',
|
printcell.colsep = '$';
|
||||||
.hidecol_flags = 0};
|
printcell.hidecol_flags = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printcell.separator = pcs->cell_separator;
|
||||||
|
printcell.titlesep = pcs->title_delimeter;
|
||||||
|
printcell.colsep = pcs->text_delimeter;
|
||||||
|
printcell.hidecol_flags = pcs->hidecol_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /* starting position of column in title string */
|
|
||||||
int width, height, user_minwidth;
|
|
||||||
int i = 0;
|
|
||||||
size_t j = 0;
|
|
||||||
rb->memset(&printcell, 0, sizeof(struct printcell_info_t));
|
|
||||||
|
|
||||||
printcell.gui_list = gui_list;
|
printcell.gui_list = gui_list;
|
||||||
printcell.separator = pcs->cell_separator;
|
|
||||||
printcell.titlesep = pcs->title_delimeter;
|
|
||||||
printcell.colsep = pcs->text_delimeter;
|
|
||||||
printcell.hidecol_flags = pcs->hidecol_flags;
|
|
||||||
|
|
||||||
int ch = printcell.titlesep; /* first column $ is optional */
|
int ch = printcell.titlesep; /* first column $ is optional */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue