1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codefix: implement StrTrimInPlace without assigning a borrowed view of itself

This commit is contained in:
Rubidium
2025-05-03 07:49:14 +02:00
committed by rubidium42
parent 4109b6848b
commit e2db8277b8
2 changed files with 10 additions and 3 deletions

View File

@@ -934,8 +934,7 @@ static bool ConClientNickChange(std::span<std::string_view> argv)
return true;
}
std::string client_name(argv[2]);
StrTrimInPlace(client_name);
std::string client_name{StrTrimView(argv[2])};
if (!NetworkIsValidClientName(client_name)) {
IConsolePrint(CC_ERROR, "Cannot give a client an empty name.");
return true;