Fix conf_verify_key

This commit is contained in:
Pradana Aumars 2021-06-12 11:01:50 +02:00
parent d15c8a688e
commit fc0f657774

View File

@ -13,22 +13,22 @@ conf_verify_key(const char *f, const char *key, char *value)
if (!g_key_file_load_from_file (key_file, f, G_KEY_FILE_NONE, &error)) if (!g_key_file_load_from_file (key_file, f, G_KEY_FILE_NONE, &error))
{ {
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) if (g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
g_warning ("Error loading key file: %s\n", error->message); g_warning ("Error loading key file: %s\n", error->message);
return 1; return 1;
} }
value = g_key_file_get_string (key_file, "Global", key, &error); value = g_key_file_get_string (key_file, "Global", key, &error);
if (value == NULL && if (value == NULL &&
!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
{ {
g_warning ("Error finding key in key file: %s\n", error->message); g_warning ("Error finding key in key file: %s\n", error->message);
return 1; return 1;
} }
else if (value == NULL) else if (value == NULL)
{ {
g_warning ("Error finding game directory.\n"); g_warning ("Error: %s.\n", error->message);
return 1; return 1;
} }
return 1; return 0;
} }