diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 2a484f47..52b4dbc6 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -996,6 +996,13 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& return i == sPlayerbotAIConfig->randomBotMaps.end(); }), tlocs.end()); + // Check locs again in case all possible locations were removed + if (locs.empty()) + { + LOG_DEBUG("playerbots", "Cannot teleport bot {} - all locations removed by filter", bot->GetName().c_str()); + return; + } + //Random shuffle based on distance. Closer distances are more likely (but not exclusivly) to be at the begin of the list. tlocs = sTravelMgr->getNextPoint(WorldPosition(bot), tlocs, 0);