summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-05-21 21:22:44 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2022-05-21 21:23:19 (GMT)
commit634d6f20c98dffc17b6d332290a4f08737cede18 (patch)
tree3f971d5120e6f54320d582125adaf1b1449185eb
parent97220f5b3f8b8c744466668c9689168953843594 (diff)
downloadCMake-634d6f20c98dffc17b6d332290a4f08737cede18.zip
CMake-634d6f20c98dffc17b6d332290a4f08737cede18.tar.gz
CMake-634d6f20c98dffc17b6d332290a4f08737cede18.tar.bz2
cmGlobalGenerator: check for `nullptr` in `GetLanguageFromExtension`
Found by `clang-analyzer`.
-rw-r--r--Source/cmGlobalGenerator.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3831546..4d636e4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1152,7 +1152,10 @@ std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
{
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
- if (ext && *ext == '.') {
+ if (!ext) {
+ return "";
+ }
+ if (*ext == '.') {
++ext;
}
auto const it = this->ExtensionToLanguage.find(ext);