Merge lp:~stolowski/unity-lens-files/devices-crash-fix into lp:unity-lens-files

Proposed by Paweł Stołowski
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 239
Merged at revision: 239
Proposed branch: lp:~stolowski/unity-lens-files/devices-crash-fix
Merge into: lp:unity-lens-files
Diff against target: 23 lines (+3/-3)
1 file modified
src/folder.vala (+3/-3)
To merge this branch: bzr merge lp:~stolowski/unity-lens-files/devices-crash-fix
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+125161@code.launchpad.net

Commit message

Don't crash on startup if device label or uuid are null.

Description of the change

Don't crash on startup if device label or uuid are null.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/folder.vala'
2--- src/folder.vala 2012-09-18 11:08:30 +0000
3+++ src/folder.vala 2012-09-19 10:53:21 +0000
4@@ -287,7 +287,7 @@
5 var label = volume.get_identifier (VolumeIdentifier.LABEL);
6 var uuid = volume.get_identifier (VolumeIdentifier.UUID);
7
8- if (label.length == 0 && uuid.length == 0)
9+ if ((label == null || label.length == 0) && (uuid == null || uuid.length == 0))
10 continue;
11
12 var device = new Device (volume);
13@@ -377,8 +377,8 @@
14 var name = volume.get_name ();
15 var icon = volume.get_icon ();
16 var icon_name = icon.to_string ();
17- var label = volume.get_identifier (VolumeIdentifier.LABEL);
18- var uuid = volume.get_identifier (VolumeIdentifier.UUID);
19+ var label = volume.get_identifier (VolumeIdentifier.LABEL) ?? "";
20+ var uuid = volume.get_identifier (VolumeIdentifier.UUID) ?? "";
21 var id = "device://" + uuid + "-" + label;
22
23 Object (volume:volume, name:name, uri:id, icon:icon,icon_name:icon_name, display_name:name, dnd_uri:id);

Subscribers

People subscribed via source and target branches