tools [utils]: fix invalid erase on ltrim()

When the string is entirely whitespace all characters except one gets
erased. Rather use size() to denote the end of the string.

Change-Id: I80bf92319d4725b9400e0f67e968e3cb8c27dd86
Pick-to: 6.9 6.8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Dennis Oberst 2025-03-27 19:10:23 +01:00
parent 839b9372f8
commit cb5cc69cb3
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@ std::string &rtrim(std::string &s)
std::string &ltrim(std::string &s)
{
const size_t cut = s.find_first_not_of(asciiSpacing);
s.erase(0, cut == std::string::npos ? s.size() - 1 : cut);
s.erase(0, cut == std::string::npos ? s.size() : cut);
return s;
}