Codefix: std::move string leaves the old one in an undefined state

This commit is contained in:
Rubidium
2025-03-08 16:56:29 +01:00
committed by rubidium42
parent 7c97460080
commit afe66c7df4
2 changed files with 4 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ static std::vector<std::string> EscapeQuotesAndSlashesAndSplitOnNewLines(const s
for (auto c : message) {
if (c == '\n') {
messages.emplace_back(std::move(safe_message));
safe_message.clear(); // std::move leaves safe_message in a "valid but unspecified state" according to the specification.
continue;
}