diff --git a/src/filelister.cpp b/src/filelister.cpp index 54af556..cfe278f 100644 --- a/src/filelister.cpp +++ b/src/filelister.cpp @@ -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) {