Merge lp:~osomon/unity-lens-files/noxdguserdirs into lp:unity-lens-files

Proposed by Olivier Tilloy
Status: Merged
Approved by: Michal Hruby
Approved revision: 211
Merged at revision: 211
Proposed branch: lp:~osomon/unity-lens-files/noxdguserdirs
Merge into: lp:unity-lens-files
Diff against target: 13 lines (+4/-0)
1 file modified
src/daemon.vala (+4/-0)
To merge this branch: bzr merge lp:~osomon/unity-lens-files/noxdguserdirs
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+92985@code.launchpad.net

Description of the change

Although unlikely in "normal" use cases, Environment.get_user_special_dir(UserDirectory.DOWNLOAD) may return NULL (see http://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-get-user-special-dir).
If it does, the files lens won’t display any search results. Instead of letting that happen, just check the result of get_user_special_dir(…), and ignore the downloaded files if it’s NULL.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks good, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2012-01-30 15:00:57 +0000
3+++ src/daemon.vala 2012-02-14 13:52:38 +0000
4@@ -692,6 +692,10 @@
5 // FIXME: Store the Downloads folder and update on changes
6 unowned string download_path =
7 Environment.get_user_special_dir (UserDirectory.DOWNLOAD);
8+ if (download_path == null) {
9+ warning ("Download directory unknown, skipping.");
10+ return;
11+ }
12 var download_dir = File.new_for_path (download_path);
13 SList<FileInfo> downloads;
14

Subscribers

People subscribed via source and target branches