From 634d6f20c98dffc17b6d332290a4f08737cede18 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 21 May 2022 17:22:44 -0400 Subject: cmGlobalGenerator: check for `nullptr` in `GetLanguageFromExtension` Found by `clang-analyzer`. --- Source/cmGlobalGenerator.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v0.12