[Bug Fix] Fix Crash with null Argument in #modifynpcstat (#4318)

* [Bug Fix] Fix Crash with null Argument in #modifynpcstat

* Update modifynpcstat.cpp

* Update modifynpcstat.cpp
This commit is contained in:
Alex King 2024-05-24 19:27:43 -04:00 committed by GitHub
parent 0d1cbecb55
commit 6bcd8fea18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,8 +16,14 @@ void command_modifynpcstat(Client *c, const Seperator *sep)
auto target = c->GetTarget()->CastToNPC();
std::string stat = sep->arg[1];
std::string value = sep->arg[2] ? sep->arg[2] : "";
const std::string& stat = sep->arg[1] ? sep->arg[1] : "";
const std::string& value = sep->arg[2] ? sep->arg[2] : "";
if (stat.empty() || value.empty()) {
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
ListModifyNPCStatMap(c);
return;
}
auto stat_description = GetModifyNPCStatDescription(stat);
if (!stat_description.length()) {