Skip to content

Commit

Permalink
fix crash in load map dialog when you have no permissions on /media
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Oct 30, 2016
1 parent 2db29bb commit 09d988b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/desktop/paths.cpp
Expand Up @@ -109,9 +109,16 @@ void enumerate_storage_devices(std::vector<path_info>& res)

for(const auto& mnt : candidates) {
bsys::error_code e;
if(bfs::is_directory(mnt, e) && !bfs::is_empty(mnt, e) && !e) {
DBG_DU << "enumerate_mount_parents(): " << mnt << " appears to be a non-empty dir\n";
res.push_back({mnt, "", mnt});
try {
if(bfs::is_directory(mnt, e) && !bfs::is_empty(mnt, e) && !e) {
DBG_DU << "enumerate_mount_parents(): " << mnt << " appears to be a non-empty dir\n";
res.push_back({mnt, "", mnt});
}
}
catch(...) {
//bool is_empty(const path& p, system::error_code& ec) might throw.
//For example if you have no permission on that directory. Don't list the file in that case.
DBG_DU << "caught exception in enumerate_storage_devices\n";
}
}

Expand Down

0 comments on commit 09d988b

Please sign in to comment.