fix bug in utils::strcompress()

calling back() on empty strings is undefined behavior.
This commit is contained in:
Richard Berger
2025-02-21 23:31:51 -07:00
parent 3141723c24
commit 4d453a65e6

View File

@ -156,7 +156,7 @@ std::string utils::strcompress(const std::string &text)
}
// remove trailing blank
if (output.back() == ' ') output.erase(output.size() - 1, 1);
if (!output.empty() && output.back() == ' ') output.erase(output.size() - 1, 1);
return output;
}