mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 03:06:15 +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;
|
string slashedPath = path;
|
||||||
if (path[path.length() - 1] != '/')
|
if (!path.empty() && path[path.length() - 1] != '/') {
|
||||||
slashedPath.push_back('/');
|
slashedPath.push_back('/');
|
||||||
|
}
|
||||||
|
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
if ((dirp = opendir(slashedPath.c_str())) == NULL) {
|
if ((dirp = opendir(slashedPath.c_str())) == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user