Skip to content

Commit

Permalink
Several crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengPeiRu21 committed Mar 23, 2022
1 parent f1bcca1 commit 180014e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/TravelMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,10 @@ std::vector<WorldPosition> 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;

Expand Down

0 comments on commit 180014e

Please sign in to comment.