Add check to make sure there are races available for a class

This commit is contained in:
Revision
2024-10-04 21:17:19 +02:00
parent 269deafc84
commit 5f50b6fddc

View File

@@ -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);