diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2015-09-28 17:06:29 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2015-09-28 17:06:29 +1300 |
commit | 507aff23c30da749d96e1cd41c9082513ced83e6 (patch) | |
tree | 22ca937fd167ea750256df662f10553fb5f28856 /src | |
parent | 99dc56c4254ea9b3b115401fda18e1935be5d897 (diff) | |
download | ayatana-indicator-bluetooth-507aff23c30da749d96e1cd41c9082513ced83e6.tar.gz ayatana-indicator-bluetooth-507aff23c30da749d96e1cd41c9082513ced83e6.tar.bz2 ayatana-indicator-bluetooth-507aff23c30da749d96e1cd41c9082513ced83e6.zip |
Check for NULL when getting cached properties Address and UUIDs
Diffstat (limited to 'src')
-rw-r--r-- | src/bluez.vala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bluez.vala b/src/bluez.vala index 208ae75..80682cc 100644 --- a/src/bluez.vala +++ b/src/bluez.vala @@ -273,7 +273,7 @@ public class Bluez: Bluetooth, Object // look up the device's bus address v = device_proxy.get_cached_property ("Address"); - var address = v.get_string (); + var address = v == null ? null : v.get_string (); // look up the device's bus address v = device_proxy.get_cached_property ("Icon"); @@ -285,10 +285,13 @@ public class Bluez: Bluetooth, Object // derive the uuid-related attributes we care about v = device_proxy.get_cached_property ("UUIDs"); - string[] uuid_strings = v.dup_strv (); uint16[] uuids = {}; - foreach (var s in uuid_strings) - uuids += get_uuid16_from_uuid_string (s); + if (v != null) + { + string[] uuid_strings = v.dup_strv (); + foreach (var s in uuid_strings) + uuids += get_uuid16_from_uuid_string (s); + } var supports_browsing = device_supports_browsing (uuids); var supports_file_transfer = device_supports_file_transfer (uuids); |