Commit a410c269 authored by Bastien Nocera's avatar Bastien Nocera

linux: Bail out when iDevice state is malformed

If there's no BatteryCurrentCapacity value, we've failed updating
the device.
parent e37fcd1d
......@@ -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);
......
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