Merge lp:~robert-ancell/indicator-bluetooth/handle-null-properties into lp:indicator-bluetooth/15.10

Proposed by Robert Ancell
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 92
Merged at revision: 92
Proposed branch: lp:~robert-ancell/indicator-bluetooth/handle-null-properties
Merge into: lp:indicator-bluetooth/15.10
Diff against target: 28 lines (+7/-4)
1 file modified
src/bluez.vala (+7/-4)
To merge this branch: bzr merge lp:~robert-ancell/indicator-bluetooth/handle-null-properties
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Indicator Applet Developers Pending
Review via email: mp+272547@code.launchpad.net

Commit message

Check for NULL when getting cached properties Address and UUIDs.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Good to not segfault, do you have any idea why we end up with having null values there though?

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I couldn't reproduce any case here where this occurred, my theories are:
- The object is created without these properties and they are updated later (driver dependant?).
- The properties aren't in the proxys cache for some reason (code inspection didn't show any issue I could see on how we set up the proxy).
- The driver / device is faulty and doesn't have these properties.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bluez.vala'
2--- src/bluez.vala 2015-08-07 02:52:28 +0000
3+++ src/bluez.vala 2015-09-28 04:11:12 +0000
4@@ -273,7 +273,7 @@
5
6 // look up the device's bus address
7 v = device_proxy.get_cached_property ("Address");
8- var address = v.get_string ();
9+ var address = v == null ? null : v.get_string ();
10
11 // look up the device's bus address
12 v = device_proxy.get_cached_property ("Icon");
13@@ -285,10 +285,13 @@
14
15 // derive the uuid-related attributes we care about
16 v = device_proxy.get_cached_property ("UUIDs");
17- string[] uuid_strings = v.dup_strv ();
18 uint16[] uuids = {};
19- foreach (var s in uuid_strings)
20- uuids += get_uuid16_from_uuid_string (s);
21+ if (v != null)
22+ {
23+ string[] uuid_strings = v.dup_strv ();
24+ foreach (var s in uuid_strings)
25+ uuids += get_uuid16_from_uuid_string (s);
26+ }
27 var supports_browsing = device_supports_browsing (uuids);
28 var supports_file_transfer = device_supports_file_transfer (uuids);
29

Subscribers

People subscribed via source and target branches