Several crash fixes

This commit is contained in:
郑佩茹
2022-03-23 10:53:04 -06:00
parent f1bcca1a7b
commit 180014eb88
2 changed files with 5 additions and 1 deletions

View File

@@ -250,7 +250,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
UpdateAIInternal(elapsed, min); UpdateAIInternal(elapsed, min);
// test fix lags because of BG // test fix lags because of BG
if (!bot->IsInCombat()) if (bot && !bot->IsInCombat())
min = true; min = true;
YieldThread(min); YieldThread(min);

View File

@@ -3955,6 +3955,10 @@ std::vector<WorldPosition> TravelMgr::getNextPoint(WorldPosition center, std::ve
rnd -= weights[i]; 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()) if (!retVec.empty())
return retVec; return retVec;