shell-global: Handle empty variants better

In cases where we have an array of 0 elements or similar, the
data returned may be NULL. Since g_file_replace_contents will
assert in this case, simply check for this and delete the file
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=710137
This commit is contained in:
Jasper St. Pierre 2013-10-14 00:00:24 -04:00
parent e0b87f1e14
commit c9b73ac731

View File

@ -1770,7 +1770,7 @@ shell_global_set_runtime_state (ShellGlobal *global,
path = get_runtime_state_path (global, property_name);
if (variant == NULL)
if (variant == NULL || g_variant_get_data (variant) == NULL)
(void) g_file_delete (path, NULL, NULL);
else
{