fix segmenation fault in theme initialization

- initializes theme with conf->colors instead of NULL
- ensures conf->initial_color_theme is not out of range
This commit is contained in:
csskevin 2025-08-22 13:25:19 +02:00
parent 72d9a13c0c
commit e8dcfe8a3f
2 changed files with 8 additions and 4 deletions

View file

@ -1107,8 +1107,12 @@ parse_section_main(struct context *ctx)
sizeof(conf->initial_color_theme) == sizeof(int),
"enum is not 32-bit");
return value_to_enum(ctx, (const char*[]){"1", "2", NULL},
(int *)&conf->initial_color_theme);
int initial_color_theme = conf->initial_color_theme;
bool status = value_to_enum(ctx, (const char*[]){"1", "2", NULL},
(int *)&initial_color_theme);
if(initial_color_theme != -1)
conf->initial_color_theme = initial_color_theme;
return status;
}
else {