Fix crash caused by attempting to close a nonexistent DIR*
This commit is contained in:
parent
c4e694fb7b
commit
fd5406282d
|
@ -275,7 +275,10 @@ std::vector<String> list_files(const String& prefix,
|
||||||
{
|
{
|
||||||
kak_assert(dirname.empty() or dirname.back() == '/');
|
kak_assert(dirname.empty() or dirname.back() == '/');
|
||||||
DIR* dir = opendir(dirname.empty() ? "./" : dirname.c_str());
|
DIR* dir = opendir(dirname.empty() ? "./" : dirname.c_str());
|
||||||
auto closeDir = on_scope_end([=]{ closedir(dir); });
|
auto closeDir = on_scope_end([=]{
|
||||||
|
if (dir != NULL)
|
||||||
|
closedir(dir);
|
||||||
|
});
|
||||||
|
|
||||||
std::vector<String> result;
|
std::vector<String> result;
|
||||||
if (not dir)
|
if (not dir)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user