summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-23 13:19:33 -0500
committerBrad King <brad.king@kitware.com>2015-01-23 13:19:33 -0500
commitf6308b01398fdb5095f28662be326c66806eef20 (patch)
tree0572c3b4e58aea31a42dd08e4250405cc1afcb39
parent7ab7aa60bb88474ceb4119e79f349254910b853c (diff)
parent482c84759fb6df983d519ca2ac61e3c92c0ae7e3 (diff)
downloadcmake-f6308b01398fdb5095f28662be326c66806eef20.tar.gz
Merge branch 'backport-kwsys-directory-check-opendir' into release
-rw-r--r--Source/kwsys/Directory.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 741bcba271..7041f7bd34 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -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) )
{