fix(generator): Prevent calling `std::string::back` on an empty string

Fixes #124
main
Anthony Printup 1 year ago
parent 08204d9847
commit 079644cfeb
No known key found for this signature in database
GPG Key ID: C8CB17EEA5183BD0

@ -493,7 +493,7 @@ struct Generator {
throw std::runtime_error("Detected additional \" at the end of cmake block"); throw std::runtime_error("Detected additional \" at the end of cmake block");
} }
auto cmake_lf = tolf(cmake); auto cmake_lf = tolf(cmake);
while (cmake_lf.back() == '\n') while (!cmake_lf.empty() && cmake_lf.back() == '\n')
cmake_lf.pop_back(); cmake_lf.pop_back();
bool did_indent = false; bool did_indent = false;
for (char ch : cmake_lf) { for (char ch : cmake_lf) {

Loading…
Cancel
Save