startup: don't try parsing color names that were not specified
Dereferencing a NULL pointer is never a good idea. This fixes https://savannah.gnu.org/bugs/?51405. Reported-by: David Lawrence Ramsey <pooka109@gmail.com>master
parent
30986db708
commit
ac726f08fa
|
@ -54,7 +54,8 @@ void set_colorpairs(void)
|
||||||
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
|
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
|
||||||
bool bright = FALSE;
|
bool bright = FALSE;
|
||||||
|
|
||||||
if (parse_color_names(specified_color_combo[i],
|
if (specified_color_combo[i] != NULL &&
|
||||||
|
parse_color_names(specified_color_combo[i],
|
||||||
&foreground, &background, &bright)) {
|
&foreground, &background, &bright)) {
|
||||||
if (foreground == -1 && !using_defaults)
|
if (foreground == -1 && !using_defaults)
|
||||||
foreground = COLOR_WHITE;
|
foreground = COLOR_WHITE;
|
||||||
|
@ -63,8 +64,7 @@ void set_colorpairs(void)
|
||||||
init_pair(i + 1, foreground, background);
|
init_pair(i + 1, foreground, background);
|
||||||
interface_color_pair[i] =
|
interface_color_pair[i] =
|
||||||
COLOR_PAIR(i + 1) | (bright ? A_BOLD : A_NORMAL);
|
COLOR_PAIR(i + 1) | (bright ? A_BOLD : A_NORMAL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (i != FUNCTION_TAG)
|
if (i != FUNCTION_TAG)
|
||||||
interface_color_pair[i] = hilite_attribute;
|
interface_color_pair[i] = hilite_attribute;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue