mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 12:57:31 +02:00
Avoid out-of-range lookup when FileLister::browse is passed empty string
When the path is the empty string, it is handled as the current working directory, which is consistent with how relative paths are handled.
This commit is contained in:
parent
20725fcdda
commit
ba09d2599d
@ -71,8 +71,9 @@ bool FileLister::browse(const string& path, bool clean)
|
||||
}
|
||||
|
||||
string slashedPath = path;
|
||||
if (path[path.length() - 1] != '/')
|
||||
if (!path.empty() && path[path.length() - 1] != '/') {
|
||||
slashedPath.push_back('/');
|
||||
}
|
||||
|
||||
DIR *dirp;
|
||||
if ((dirp = opendir(slashedPath.c_str())) == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user