diff --git a/src/RandomPlayerbotFactory.cpp b/src/RandomPlayerbotFactory.cpp index 8c350130..ea6c55dd 100644 --- a/src/RandomPlayerbotFactory.cpp +++ b/src/RandomPlayerbotFactory.cpp @@ -165,6 +165,13 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls raceOptions.push_back(race); } } + + if (raceOptions.size() == 0) + { + LOG_ERROR("playerbots", "No race available for class: {}", cls); + return nullptr; + } + uint8 race = raceOptions[urand(0, raceOptions.size() - 1)]; const auto raceAndGender = CombineRaceAndGender(gender, race);