An update will be applied today, Nov30th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit d4e7f08e authored by Brad King's avatar Brad King
Browse files

Directory: Check opendir return value before using it

In Directory::GetNumberOfFilesInDirectory add a missing check for NULL.

Change-Id: I6946eec913e60f786a419264555ec800f9b34d38
parent b33e7b96
...@@ -244,6 +244,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na ...@@ -244,6 +244,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
{ {
DIR* dir = opendir(name.c_str()); DIR* dir = opendir(name.c_str());
if (!dir)
{
return 0;
}
unsigned long count = 0; unsigned long count = 0;
for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) ) for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) )
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment