gio: Handle NULL cached properties in NetworkManager monitor

g_dbus_proxy_get_cached_property() and
g_dbus_proxy_get_cached_property_names() can both return NULL if the
property cache is empty. Avoid a crash if this situation arises (which
it looks like it could, from reading the code) by gracefully bailing out
on NULL return values.

Coverity issues: #1257044, #1257045

https://bugzilla.gnome.org/show_bug.cgi?id=741229
This commit is contained in:
Philip Withnall 2014-12-07 22:41:57 +00:00 committed by Philip Withnall
parent 1f396fd7d6
commit ca0632ca5c

View File

@ -161,6 +161,9 @@ sync_properties (GNetworkMonitorNM *nm,
GNetworkConnectivity new_connectivity; GNetworkConnectivity new_connectivity;
v = g_dbus_proxy_get_cached_property (nm->priv->proxy, "Connectivity"); v = g_dbus_proxy_get_cached_property (nm->priv->proxy, "Connectivity");
if (!v)
return;
nm_connectivity = g_variant_get_uint32 (v); nm_connectivity = g_variant_get_uint32 (v);
g_variant_unref (v); g_variant_unref (v);