From 5035451af78d781e0b50db13d10e4c3ed6fcbb57 Mon Sep 17 00:00:00 2001 From: Thalix <67201730+thalix1337@users.noreply.github.com> Date: Tue, 16 Mar 2021 06:03:35 +0100 Subject: [PATCH] [Crash] Bugfix for zone crash caused by #flymode -1 (#1291) * Update command.cpp Fixed typo in the command description. * Bugfix for #flymode zone crash Bugfix for #flymode zone crash when invalid values are passed. Also, when entering #flymode without parameters, the correct syntax is now displayed. * Changed as requested --- zone/command.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 9c29bd07d..62757f2b2 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2642,9 +2642,7 @@ void command_flymode(Client *c, const Seperator *sep) { Mob *t = c; - if (strlen(sep->arg[1]) == 1 && !(sep->arg[1][0] == '0' || sep->arg[1][0] == '1' || sep->arg[1][0] == '2' || sep->arg[1][0] == '3' || sep->arg[1][0] == '4' || sep->arg[1][0] == '5')) - c->Message(Chat::White, "#flymode [0/1/2/3/4/5]"); - else { + if (strlen(sep->arg[1]) == 1 && sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 5) { if (c->GetTarget()) { t = c->GetTarget(); } @@ -2671,9 +2669,12 @@ void command_flymode(Client *c, const Seperator *sep) else if (sep->arg[1][0] == '5') { c->Message(Chat::White, "Setting %s to Levitating While Running", t->GetName()); } + } else { + c->Message(Chat::White, "#flymode [0/1/2/3/4/5]"); } } + void command_showskills(Client *c, const Seperator *sep) { Client *t=c;