KWSys Directory: Check opendir return value before using it (#15367)
In Directory::GetNumberOfFilesInDirectory add a missing check for NULL.
This commit is contained in:
parent
57622bd19d
commit
482c84759f
|
@ -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) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue