Browse Source

fix crash when my city without hero is attacked

K 1 year ago
parent
commit
70f3397a35
1 changed files with 3 additions and 1 deletions
  1. 3 1
      client/battle/BattleWindow.cpp

+ 3 - 1
client/battle/BattleWindow.cpp

@@ -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;