Commit ed0dfe44 authored by Bastien Nocera's avatar Bastien Nocera

linux: Fix warning when bluez Appearance property isn't set

The Appearance property might not be available, and would cause
warnings like:
upowerd[17733]: g_variant_get_type: assertion 'value != NULL' failed
upowerd[17733]: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed
upowerd[17733]: g_variant_get_uint16: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_UINT16)' failed
parent 8e6cb06f
Pipeline #71613 passed with stage
in 4 minutes and 7 seconds
......@@ -71,7 +71,6 @@ up_device_bluez_coldplug (UpDevice *device)
GDBusProxy *proxy;
GError *error = NULL;
UpDeviceKind kind;
guint16 appearance;
const char *uuid;
const char *model;
GVariant *v;
......@@ -95,9 +94,15 @@ up_device_bluez_coldplug (UpDevice *device)
v = g_dbus_proxy_get_cached_property (proxy, "Appearance");
appearance = g_variant_get_uint16 (v);
kind = appearance_to_kind (appearance);
g_variant_unref (v);
if (v) {
guint16 appearance;
appearance = g_variant_get_uint16 (v);
kind = appearance_to_kind (appearance);
g_variant_unref (v);
} else {
v = g_dbus_proxy_get_cached_property (proxy, "Address");
uuid = g_variant_get_string (v, NULL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment