From cea3ad6a4268272d69c9023bf324aedf4138722b Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 7 Oct 2023 14:00:27 -0500 Subject: [PATCH] [Crash] Fix crash in #movechar (#3612) --- zone/gm_commands/movechar.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zone/gm_commands/movechar.cpp b/zone/gm_commands/movechar.cpp index 1acde33a1..6ce81fd61 100755 --- a/zone/gm_commands/movechar.cpp +++ b/zone/gm_commands/movechar.cpp @@ -46,7 +46,12 @@ void command_movechar(Client *c, const Seperator *sep) } auto zone_id = ZoneID(zone_short_name); - std::string zone_long_name = ZoneLongName(zone_id); + auto z = GetZone(zone_id); + + if (!z) { + c->Message(Chat::Red, "Invalid zone."); + return; + } bool is_special_zone = ( zone_short_name.find("cshome") != std::string::npos || @@ -59,7 +64,7 @@ void command_movechar(Client *c, const Seperator *sep) Chat::White, fmt::format( "{} ({}) is a special zone and you cannot move someone there.", - zone_long_name, + z->long_name, zone_short_name ).c_str() ); @@ -91,7 +96,7 @@ void command_movechar(Client *c, const Seperator *sep) fmt::format( "Character Move {} | Zone: {} ({}) ID: {}", moved_string, - zone_long_name, + z->long_name, zone_short_name, zone_id ).c_str()