KWSys Directory: Check opendir return value before using it (#15367)

In Directory::GetNumberOfFilesInDirectory add a missing check for NULL.
This commit is contained in:
Brad King 2015-01-23 13:14:01 -05:00
parent 57622bd19d
commit 482c84759f
1 changed files with 5 additions and 0 deletions

View File

@ -239,6 +239,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
{
DIR* dir = opendir(name.c_str());
if (!dir)
{
return 0;
}
unsigned long count = 0;
for (dirent* d = readdir(dir); d; d = readdir(dir) )
{