gsettings-tool: implement range-checking

Prevent assertion messages from spewing forth and also ensure that we
exit with an error status in the event that the value was out of range.

Bug #631264.
This commit is contained in:
Ryan Lortie 2010-10-04 03:40:22 -04:00
parent e740c5b4cd
commit 59bdba3cbb

View File

@ -293,6 +293,13 @@ gsettings_set (GSettings *settings,
exit (1); exit (1);
} }
if (!g_settings_range_check (settings, key, new))
{
g_printerr ("The provided value is outside of the valid range\n");
g_variant_unref (new);
exit (1);
}
g_settings_set_value (settings, key, new); g_settings_set_value (settings, key, new);
g_variant_unref (existing); g_variant_unref (existing);
g_variant_unref (new); g_variant_unref (new);