From 180014eb88200045a7a7068f3f5cbe729bb54df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Wed, 23 Mar 2022 10:53:04 -0600 Subject: [PATCH] Several crash fixes --- src/PlayerbotAI.cpp | 2 +- src/TravelMgr.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index cd10d1c2..1f5dcc1d 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -250,7 +250,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) UpdateAIInternal(elapsed, min); // test fix lags because of BG - if (!bot->IsInCombat()) + if (bot && !bot->IsInCombat()) min = true; YieldThread(min); diff --git a/src/TravelMgr.cpp b/src/TravelMgr.cpp index 09f15da4..c06f7f68 100644 --- a/src/TravelMgr.cpp +++ b/src/TravelMgr.cpp @@ -3955,6 +3955,10 @@ std::vector TravelMgr::getNextPoint(WorldPosition center, std::ve rnd -= weights[i]; } + // Peiru: Crash failsafe - if the retVec is still empty but points exist, return first point + if (retVec.empty() && points.size() > 0) + retVec.push_back(points[0]); + if (!retVec.empty()) return retVec;