1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Access CHero in a way that will throw exception on invalid access

instead of crash
This commit is contained in:
Ivan Savenko 2023-12-13 16:50:56 +02:00
parent 0dce278a3b
commit 76cb5387c5

View File

@ -503,7 +503,7 @@ void OptionsTab::SelectionWindow::recreate()
int count = 0; int count = 0;
for(auto & elem : allowedHeroes) for(auto & elem : allowedHeroes)
{ {
CHero * type = VLC->heroh->objects[elem]; const CHero * type = elem.toHeroType();
if(type->heroClass->faction == selectedFaction) if(type->heroClass->faction == selectedFaction)
{ {
count++; count++;