From d91ac911e77d7f39a2c9140133fa0e3c7a4a9bc1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 4 Mar 2012 19:43:47 +0000 Subject: [PATCH] fix complete_filename when directory does not exist --- src/completion.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/completion.cc b/src/completion.cc index 3ab9b92b..17482d14 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -28,6 +28,9 @@ CandidateList complete_filename(const std::string& prefix, auto dir = auto_raii(opendir(dirname.c_str()), closedir); CandidateList result; + if (not dir) + return result; + while (dirent* entry = readdir(dir)) { std::string filename = entry->d_name;