1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #4388 from kaja47/fix-crash-defense

fix crash when my city without hero is attacked
This commit is contained in:
Andrii Danylchenko 2024-08-06 17:50:04 +03:00 committed by GitHub
commit f34ffcc727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -218,7 +218,9 @@ void BattleWindow::showStickyQuickSpellWindow()
Settings showStickyQuickSpellWindow = settings.write["battle"]["enableQuickSpellPanel"];
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->isEnabled = true;