summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFindLibraryCommand.cxx2
-rw-r--r--Source/cmFindPathCommand.cxx2
-rw-r--r--Source/kwsys/SystemTools.cxx6
3 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index e7cfbeb..6f0b23a 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -186,7 +186,7 @@ std::string cmFindLibraryCommand::FindLibrary(const char* name)
i != this->SearchPaths.end(); ++i)
{
std::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 53531dd..6280187 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -106,7 +106,7 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
i != this->SearchPaths.end(); ++i)
{
std::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index de00019..d209682 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2117,7 +2117,7 @@ kwsys_stl::string SystemTools
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
@@ -2249,7 +2249,7 @@ kwsys_stl::string SystemTools::FindProgram(
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
@@ -2341,7 +2341,7 @@ kwsys_stl::string SystemTools
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}