mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gpowerprofilemonitordbus: Fix a crash if no property is cached
It’s not always guaranteed that a property is cached, so handle the case when it isn’t. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
28ad07373a
commit
a37b9d8652
@ -116,7 +116,8 @@ ppd_proxy_cb (GObject *source_object,
|
||||
}
|
||||
|
||||
active_profile_variant = g_dbus_proxy_get_cached_property (proxy, "ActiveProfile");
|
||||
if (g_variant_is_of_type (active_profile_variant, G_VARIANT_TYPE_STRING))
|
||||
if (active_profile_variant != NULL &&
|
||||
g_variant_is_of_type (active_profile_variant, G_VARIANT_TYPE_STRING))
|
||||
{
|
||||
active_profile = g_variant_get_string (active_profile_variant, NULL);
|
||||
power_saver_enabled = g_strcmp0 (active_profile, "power-saver") == 0;
|
||||
|
Loading…
Reference in New Issue
Block a user