[Crash Fix] Goto Command could crash using Developer Tools (#4158)

This commit is contained in:
Mitch Freeman 2024-03-03 23:33:12 -04:00 committed by GitHub
parent 74a63daf7e
commit b4605f77e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@
void command_goto(Client *c, const Seperator *sep)
{
std::string arg1 = sep->arg[1];
std::string arg4 = sep->arg[4];
bool goto_via_target_no_args = sep->arg[1][0] == '\0' && c->GetTarget();
bool goto_via_player_name = !sep->IsNumber(1) && !arg1.empty();
@ -52,7 +53,7 @@ void command_goto(Client *c, const Seperator *sep)
Strings::ToFloat(sep->arg[1]),
Strings::ToFloat(sep->arg[2]),
Strings::ToFloat(sep->arg[3]),
(sep->arg[4] ? Strings::ToFloat(sep->arg[4]) : c->GetHeading())
(!arg4.empty() ? Strings::ToFloat(sep->arg[4]) : c->GetHeading())
);
}
else {