summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2004-08-04 21:24:21 (GMT)
committerBrad King <brad.king@kitware.com>2004-08-04 21:24:21 (GMT)
commit3c5bccf8a13418bc666798dd517b52f456bb2c80 (patch)
tree835f9d08a91ea7f49482f8dee4645899edafea44 /Source/cmMakefile.cxx
parent023f5d1f25a5daaadd471805afd47c29ca6d65a5 (diff)
downloadCMake-3c5bccf8a13418bc666798dd517b52f456bb2c80.zip
CMake-3c5bccf8a13418bc666798dd517b52f456bb2c80.tar.gz
CMake-3c5bccf8a13418bc666798dd517b52f456bb2c80.tar.bz2
BUG: Fix crash when adding a custom command to a source file that cannot be created.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 1f6b8f2..3e3c87b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -669,13 +669,18 @@ AddCustomCommandToOutput(const char* outputIn,
}
// create a cmSourceFile for the output
file = this->GetOrCreateSource(outName.c_str(), true);
- // always mark as generated
- file->SetProperty("GENERATED","1");
+ if(file)
+ {
+ // always mark as generated
+ file->SetProperty("GENERATED","1");
+ }
}
// always create the output and mark it generated
- cmSourceFile *out = this->GetOrCreateSource(output.c_str(), true);
- out->SetProperty("GENERATED","1");
+ if(cmSourceFile *out = this->GetOrCreateSource(output.c_str(), true))
+ {
+ out->SetProperty("GENERATED","1");
+ }
std::vector<std::string> depends2(depends);
if (main_dependency && main_dependency[0] != '\0')
@@ -689,11 +694,14 @@ AddCustomCommandToOutput(const char* outputIn,
{
cc->SetComment(comment);
}
- if (file->GetCustomCommand())
+ if(file)
{
- delete file->GetCustomCommand();
+ if (file->GetCustomCommand())
+ {
+ delete file->GetCustomCommand();
+ }
+ file->SetCustomCommand(cc);
}
- file->SetCustomCommand(cc);
}
void cmMakefile::