From 76cb5387c5d3661923cec9a9feca2110f76ea9fb Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 13 Dec 2023 16:50:56 +0200 Subject: [PATCH] Access CHero in a way that will throw exception on invalid access instead of crash --- client/lobby/OptionsTab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/lobby/OptionsTab.cpp b/client/lobby/OptionsTab.cpp index e7698ba48..246104a76 100644 --- a/client/lobby/OptionsTab.cpp +++ b/client/lobby/OptionsTab.cpp @@ -503,7 +503,7 @@ void OptionsTab::SelectionWindow::recreate() int count = 0; for(auto & elem : allowedHeroes) { - CHero * type = VLC->heroh->objects[elem]; + const CHero * type = elem.toHeroType(); if(type->heroClass->faction == selectedFaction) { count++;