fix(Scripts/Commands): Fix assertion error on mmaps path command (#13704)

This commit is contained in:
Mickaël Mauger
2022-11-16 05:24:27 +01:00
committed by GitHub
parent 772fe38fe9
commit 2e5e3bda5d

View File

@@ -61,7 +61,7 @@ public:
return commandTable;
}
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> para)
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> param)
{
if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
@@ -81,13 +81,19 @@ public:
}
bool useStraightPath = false;
if (StringStartsWith("true", *para))
useStraightPath = true;
bool useRaycast = false;
if (StringStartsWith("line", *para) || StringStartsWith("ray", *para) || StringStartsWith("raycast", *para))
if (param)
{
useRaycast = true;
auto paramValue = param.value();
if (paramValue.starts_with("true"))
{
useStraightPath = true;
}
if (paramValue.starts_with("line") || paramValue.starts_with("ray") || paramValue.starts_with("raycast"))
{
useRaycast = true;
}
}
// unit locations