From e177324a647a377e7d3dfbe1da945a5b50a5284f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Fri, 25 Mar 2022 10:43:52 -0600 Subject: [PATCH] Prevent another crash in RandomTeleport --- src/RandomPlayerbotMgr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index d950a7b5..750f9ab0 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -1071,9 +1071,11 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& } bot->GetMotionMaster()->Clear(); + PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); + if (botAI) + botAI->Reset(); bot->TeleportTo(loc.GetMapId(), x, y, z, 0); bot->SendMovementFlagUpdate(); - GET_PLAYERBOT_AI(bot)->Reset(); if (pmo) pmo->finish();