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
=== modified file 'src/folder.vala'
--- src/folder.vala 2012-09-18 11:08:30 +0000
+++ src/folder.vala 2012-09-19 10:53:21 +0000
@@ -287,7 +287,7 @@
287 var label = volume.get_identifier (VolumeIdentifier.LABEL);287 var label = volume.get_identifier (VolumeIdentifier.LABEL);
288 var uuid = volume.get_identifier (VolumeIdentifier.UUID);288 var uuid = volume.get_identifier (VolumeIdentifier.UUID);
289 289
290 if (label.length == 0 && uuid.length == 0)290 if ((label == null || label.length == 0) && (uuid == null || uuid.length == 0))
291 continue;291 continue;
292 292
293 var device = new Device (volume);293 var device = new Device (volume);
@@ -377,8 +377,8 @@
377 var name = volume.get_name ();377 var name = volume.get_name ();
378 var icon = volume.get_icon ();378 var icon = volume.get_icon ();
379 var icon_name = icon.to_string ();379 var icon_name = icon.to_string ();
380 var label = volume.get_identifier (VolumeIdentifier.LABEL);380 var label = volume.get_identifier (VolumeIdentifier.LABEL) ?? "";
381 var uuid = volume.get_identifier (VolumeIdentifier.UUID);381 var uuid = volume.get_identifier (VolumeIdentifier.UUID) ?? "";
382 var id = "device://" + uuid + "-" + label;382 var id = "device://" + uuid + "-" + label;
383 383
384 Object (volume:volume, name:name, uri:id, icon:icon,icon_name:icon_name, display_name:name, dnd_uri:id);384 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