1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

fix crash when my city without hero is attacked

This commit is contained in:
K 2024-08-04 16:49:53 +02:00
parent c8b48318b7
commit 70f3397a35

View File

@ -218,7 +218,9 @@ void BattleWindow::showStickyQuickSpellWindow()
Settings showStickyQuickSpellWindow = settings.write["battle"]["enableQuickSpellPanel"]; Settings showStickyQuickSpellWindow = settings.write["battle"]["enableQuickSpellPanel"];
showStickyQuickSpellWindow->Bool() = true; showStickyQuickSpellWindow->Bool() = true;
if(GH.screenDimensions().x >= 1050 && owner.getBattle()->battleGetMyHero()->hasSpellbook()) auto hero = owner.getBattle()->battleGetMyHero();
if(GH.screenDimensions().x >= 1050 && hero != nullptr && hero->hasSpellbook())
{ {
quickSpellWindow->enable(); quickSpellWindow->enable();
quickSpellWindow->isEnabled = true; quickSpellWindow->isEnabled = true;