menu: Fix 2 uncaught NULL derefs

This commit is contained in:
mintsuki 2022-04-22 16:42:30 +02:00
parent d454935ec6
commit cac57ced41

View File

@ -180,11 +180,17 @@ char *config_entry_editor(const char *title, const char *orig_entry) {
bool syntax_highlighting_enabled = true;
char *syntax_highlighting_enabled_config = config_get_value(NULL, 0, "EDITOR_HIGHLIGHTING");
if (!strcmp(syntax_highlighting_enabled_config, "no")) syntax_highlighting_enabled = false;
if (syntax_highlighting_enabled_config != NULL
&& strcmp(syntax_highlighting_enabled_config, "no") == 0) {
syntax_highlighting_enabled = false;
}
validation_enabled = true;
char *validation_enabled_config = config_get_value(NULL, 0, "EDITOR_VALIDATION");
if (!strcmp(validation_enabled_config, "no")) validation_enabled = false;
if (validation_enabled_config != NULL
&& strcmp(validation_enabled_config, "no") == 0) {
validation_enabled = false;
}
char *buffer = ext_mem_alloc(EDITOR_MAX_BUFFER_SIZE);
memcpy(buffer, orig_entry, entry_size);