mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
Merge pull request #577 from noisiver/fix-null-check
Add check to make sure there are races available for a class before generation
This commit is contained in:
commit
4fc9bca5ab
@ -165,6 +165,13 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
|
|||||||
raceOptions.push_back(race);
|
raceOptions.push_back(race);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (raceOptions.empty())
|
||||||
|
{
|
||||||
|
LOG_ERROR("playerbots", "No races available for class: {}", cls);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 race = raceOptions[urand(0, raceOptions.size() - 1)];
|
uint8 race = raceOptions[urand(0, raceOptions.size() - 1)];
|
||||||
|
|
||||||
const auto raceAndGender = CombineRaceAndGender(gender, race);
|
const auto raceAndGender = CombineRaceAndGender(gender, race);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user