ソースを参照

cmGlobalGenerator: check for `nullptr` in `GetLanguageFromExtension`

Found by `clang-analyzer`.
Ben Boeckel 3 年 前
コミット
634d6f20c9
1 ファイル変更4 行追加1 行削除
  1. 4 1
      Source/cmGlobalGenerator.cxx

+ 4 - 1
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);