summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Szulecki <martin.szulecki@libimobiledevice.org>2018-03-20 15:00:21 +0100
committerBastien Nocera <hadess@hadess.net>2018-03-20 15:28:36 +0100
commit9357aa60e7773d997e6208c9b3cab09adc166e38 (patch)
tree91da9fce4764ffcfe1816290bdc32b51d6f0ecd3
parent41bce284476030b22cd6d60280fb875f507f47a2 (diff)
downloadupower-9357aa60e7773d997e6208c9b3cab09adc166e38.tar.gz
linux: Prevent crash after attaching an Apple TV
As Apple TVs do not have a battery and do not provide the "BatteryIsCharging" lockdown key, upower would crash due to a missing check whether the retrieved node is actually valid. https://bugzilla.freedesktop.org/show_bug.cgi?id=105625
-rw-r--r--src/linux/up-device-idevice.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c
index 97d230c..a583881 100644
--- a/src/linux/up-device-idevice.c
+++ b/src/linux/up-device-idevice.c
@@ -297,6 +297,10 @@ up_device_idevice_refresh (UpDevice *device)
/* get charging status */
node = plist_dict_get_item (dict, "BatteryIsCharging");
+ if (!node) {
+ plist_free(dict);
+ goto out;
+ }
plist_get_bool_val (node, &charging);
if (percentage == 100)