fix complete_filename when directory does not exist

This commit is contained in:
Maxime Coste 2012-03-04 19:43:47 +00:00
parent 454258a495
commit d91ac911e7

View File

@ -28,6 +28,9 @@ CandidateList complete_filename(const std::string& prefix,
auto dir = auto_raii(opendir(dirname.c_str()), closedir); auto dir = auto_raii(opendir(dirname.c_str()), closedir);
CandidateList result; CandidateList result;
if (not dir)
return result;
while (dirent* entry = readdir(dir)) while (dirent* entry = readdir(dir))
{ {
std::string filename = entry->d_name; std::string filename = entry->d_name;