Browse Source

cmake: Avoid calling GetCMakeListFile with empty directory

Brad King 1 month ago
parent
commit
40b093649b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/cmake.cxx

+ 2 - 2
Source/cmake.cxx

@@ -4517,8 +4517,8 @@ void cmake::SetCMakeListName(std::string const& name)
 
 std::string cmake::GetCMakeListFile(std::string const& dir) const
 {
-  cm::string_view const slash =
-    dir.empty() || dir.back() != '/' ? "/"_s : ""_s;
+  assert(!dir.empty());
+  cm::string_view const slash = dir.back() != '/' ? "/"_s : ""_s;
   std::string listFile;
   if (!this->CMakeListName.empty()) {
     listFile = cmStrCat(dir, slash, this->CMakeListName);