mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-14 15:18:09 +02:00
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
This commit is contained in:
parent
8e6cb06ff6
commit
ed0dfe4427
1 changed files with 9 additions and 4 deletions
|
|
@ -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 {
|
||||
kind = UP_DEVICE_KIND_UNKNOWN;
|
||||
}
|
||||
|
||||
v = g_dbus_proxy_get_cached_property (proxy, "Address");
|
||||
uuid = g_variant_get_string (v, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue