Merge lp:~seb128/ubuntu-system-settings/bluetooth-null-device into lp:ubuntu-system-settings

Proposed by Sebastien Bacher
Status: Merged
Approved by: Ken VanDine
Approved revision: 1337
Merged at revision: 1384
Proposed branch: lp:~seb128/ubuntu-system-settings/bluetooth-null-device
Merge into: lp:ubuntu-system-settings
Diff against target: 18 lines (+5/-3)
1 file modified
plugins/bluetooth/devicemodel.cpp (+5/-3)
To merge this branch: bzr merge lp:~seb128/ubuntu-system-settings/bluetooth-null-device
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+250895@code.launchpad.net

Commit message

bluetooth: check if the device is valid before getting details

Description of the change

bluetooth: check if the device is valid before getting details

Not sure what are the exact steps to get into that case but DeviceModel::slotDeviceRemoved() does

" auto device = getDeviceFromPath(path.path());

    const int row = findRowFromAddress(device->getAddress());"

or getDeviceFromPath() can return a null value, which leads to a segfault (saw that on a krillin device a few time while trying to pair the phone with a car (which was not working, but that's another issue)

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

Rebase on trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Excellent!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/bluetooth/devicemodel.cpp'
2--- plugins/bluetooth/devicemodel.cpp 2015-02-24 18:29:52 +0000
3+++ plugins/bluetooth/devicemodel.cpp 2015-03-11 17:41:25 +0000
4@@ -400,9 +400,11 @@
5
6 auto device = getDeviceFromPath(path.path());
7
8- const int row = findRowFromAddress(device->getAddress());
9- if ((row >= 0))
10- removeRow(row);
11+ if (device != nullptr) {
12+ const int row = findRowFromAddress(device->getAddress());
13+ if ((row >= 0))
14+ removeRow(row);
15+ }
16 }
17
18 void DeviceModel::slotDeviceDisappeared(const QString &address)

Subscribers

People subscribed via source and target branches