summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-09 16:01:10 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-09 16:01:10 (GMT)
commitef077c8ba47f39614c4b7bb6f3b745cbfa8f461e (patch)
treea962cb122cc741547666bf2d2698f879af533607 /Source
parent1c857427013d5b63daf89404d638b4733d19fee6 (diff)
parentaad360eb3d07fc34048f3065e2d3617fa07f2932 (diff)
downloadCMake-ef077c8ba47f39614c4b7bb6f3b745cbfa8f461e.zip
CMake-ef077c8ba47f39614c4b7bb6f3b745cbfa8f461e.tar.gz
CMake-ef077c8ba47f39614c4b7bb6f3b745cbfa8f461e.tar.bz2
Merge branch 'fix-crash-trace-exp-uninit-vars' into release-3.11
Merge-request: !1944
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx9
-rw-r--r--Source/cmMakefile.cxx9
2 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index bf314bd..ccb4f88 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -101,10 +101,11 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
// not been "cleared"/initialized with a set(foo ) call
if (this->WarnUninitialized && !this->Makefile->VariableInitialized(var)) {
if (this->CheckSystemVars ||
- cmSystemTools::IsSubDirectory(this->FileName,
- this->Makefile->GetHomeDirectory()) ||
- cmSystemTools::IsSubDirectory(
- this->FileName, this->Makefile->GetHomeOutputDirectory())) {
+ (this->FileName &&
+ (cmSystemTools::IsSubDirectory(
+ this->FileName, this->Makefile->GetHomeDirectory()) ||
+ cmSystemTools::IsSubDirectory(
+ this->FileName, this->Makefile->GetHomeOutputDirectory())))) {
std::ostringstream msg;
msg << "uninitialized variable \'" << var << "\'";
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg.str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b468208..71359a2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2679,10 +2679,11 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
if (this->GetCMakeInstance()->GetWarnUninitialized() &&
!this->VariableInitialized(lookup)) {
if (this->CheckSystemVars ||
- cmSystemTools::IsSubDirectory(filename,
- this->GetHomeDirectory()) ||
- cmSystemTools::IsSubDirectory(
- filename, this->GetHomeOutputDirectory())) {
+ (filename &&
+ (cmSystemTools::IsSubDirectory(filename,
+ this->GetHomeDirectory()) ||
+ cmSystemTools::IsSubDirectory(
+ filename, this->GetHomeOutputDirectory())))) {
std::ostringstream msg;
msg << "uninitialized variable \'" << lookup << "\'";
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str());