summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 085d988..1054d65 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2754,9 +2754,15 @@ kwsys_stl::string SystemTools::GetRealPath(const char* path)
bool SystemTools::FileIsDirectory(const char* name)
{
+ size_t length = strlen(name);
+ if (length == 0)
+ {
+ return false;
+ }
+
// Remove any trailing slash from the name.
char buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
- size_t last = strlen(name)-1;
+ size_t last = length-1;
if(last > 0 && (name[last] == '/' || name[last] == '\\')
&& strcmp(name, "/") !=0)
{