mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 05:18:00 +02:00
linux: Bail out when iDevice state is malformed
If there's no BatteryCurrentCapacity value, we've failed updating the device.
This commit is contained in:
parent
e37fcd1db1
commit
a410c26991
1 changed files with 4 additions and 0 deletions
|
|
@ -193,6 +193,10 @@ up_device_idevice_refresh (UpDevice *device)
|
|||
|
||||
/* get battery status */
|
||||
node = plist_dict_get_item (dict, "BatteryCurrentCapacity");
|
||||
if (!node) {
|
||||
plist_free (dict);
|
||||
goto out;
|
||||
}
|
||||
plist_get_uint_val (node, &percentage);
|
||||
|
||||
g_object_set (device, "percentage", (double) percentage, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue