diff options
author | Mariusz Plucinski <plucinski.mariusz@gmail.com> | 2012-06-20 12:02:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-06-20 12:59:54 (GMT) |
commit | 2c2fbaf0e5902d62a4321cdac125778a2170ec5d (patch) | |
tree | dbe05d93be8094d9503cea1137d5487ff5c9af10 /Source | |
parent | d17c58c8534ba68e527a79f33fad60c502ebdde1 (diff) | |
download | CMake-2c2fbaf0e5902d62a4321cdac125778a2170ec5d.zip CMake-2c2fbaf0e5902d62a4321cdac125778a2170ec5d.tar.gz CMake-2c2fbaf0e5902d62a4321cdac125778a2170ec5d.tar.bz2 |
Do not crash on unknown source language (#13323)
If a source file extension is not recognized as any language then
src.GetLanguage() may return NULL. Check the result before
dereferencing in cmLocalGenerator::GetObjectFileNameWithoutTarget.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 13ede5d..32cfa68 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2764,10 +2764,13 @@ cmLocalGenerator bool replaceExt = this->NeedBackwardsCompatibility(2, 4); if(!replaceExt) { - std::string repVar = "CMAKE_"; - repVar += source.GetLanguage(); - repVar += "_OUTPUT_EXTENSION_REPLACE"; - replaceExt = this->Makefile->IsOn(repVar.c_str()); + if(const char* lang = source.GetLanguage()) + { + std::string repVar = "CMAKE_"; + repVar += lang; + repVar += "_OUTPUT_EXTENSION_REPLACE"; + replaceExt = this->Makefile->IsOn(repVar.c_str()); + } } // Remove the source extension if it is to be replaced. |