Browse Source

Fix possible crash on accessing faction description

Ivan Savenko 1 year ago
parent
commit
0aa7362adf
2 changed files with 2 additions and 2 deletions
  1. 1 1
      client/widgets/MiscWidgets.cpp
  2. 1 1
      client/windows/CCastleInterface.cpp

+ 1 - 1
client/widgets/MiscWidgets.cpp

@@ -466,7 +466,7 @@ void CInteractableTownTooltip::init(const CGTownInstance * town)
 			if(town->id == townId && town->builtBuildings.count(BuildingID::TAVERN))
 				LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
 		}
-	}, [&]{
+	}, [town]{
 		if(!town->town->faction->getDescriptionTranslated().empty())
 			CRClickPopup::createAndPush(town->town->faction->getDescriptionTranslated());
 	});

+ 1 - 1
client/windows/CCastleInterface.cpp

@@ -1351,7 +1351,7 @@ void CCastleInterface::recreateIcons()
 	{
 		if(town->builtBuildings.count(BuildingID::TAVERN))
 			LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
-	}, [&]{
+	}, [this]{
 		if(!town->town->faction->getDescriptionTranslated().empty())
 			CRClickPopup::createAndPush(town->town->faction->getDescriptionTranslated());
 	});