Skip to content

Commit 079644c

Browse files
fix(generator): Prevent calling std::string::back on an empty string
Fixes #124
1 parent 08204d9 commit 079644c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmake_generator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ struct Generator {
493493
throw std::runtime_error("Detected additional \" at the end of cmake block");
494494
}
495495
auto cmake_lf = tolf(cmake);
496-
while (cmake_lf.back() == '\n')
496+
while (!cmake_lf.empty() && cmake_lf.back() == '\n')
497497
cmake_lf.pop_back();
498498
bool did_indent = false;
499499
for (char ch : cmake_lf) {

0 commit comments

Comments
 (0)