mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 20:38:48 +02:00
Be more careful about overwriting errors
When trying to parse again, we don't want to overwrite the exiting error.
This commit is contained in:
parent
78407a0098
commit
9574dbd228
@ -399,7 +399,6 @@ gsettings_set (GSettings *settings,
|
|||||||
existing = g_settings_get_value (settings, key);
|
existing = g_settings_get_value (settings, key);
|
||||||
type = g_variant_get_type (existing);
|
type = g_variant_get_type (existing);
|
||||||
|
|
||||||
parse:
|
|
||||||
new = g_variant_parse (type, value, NULL, NULL, &error);
|
new = g_variant_parse (type, value, NULL, NULL, &error);
|
||||||
|
|
||||||
/* A common error is to specify a string with single quotes
|
/* A common error is to specify a string with single quotes
|
||||||
@ -409,10 +408,12 @@ parse:
|
|||||||
* To handle this case, try to parse again with an extra level
|
* To handle this case, try to parse again with an extra level
|
||||||
* of quotes.
|
* of quotes.
|
||||||
*/
|
*/
|
||||||
if (new == NULL && !freeme && strstr (error->message, "unknown keyword"))
|
if (new == NULL && strstr (error->message, "unknown keyword"))
|
||||||
{
|
{
|
||||||
value = freeme = g_strdup_printf ("\"%s\"", value);
|
value = freeme = g_strdup_printf ("\"%s\"", value);
|
||||||
goto parse;
|
new = g_variant_parse (type, value, NULL, NULL, NULL);
|
||||||
|
if (new != NULL)
|
||||||
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user