From 1ca84f3b5d6af483dd4ce54d345c9cb9423c30f0 Mon Sep 17 00:00:00 2001 From: RecursiveVision <66801010+RecursiveVision@users.noreply.github.com> Date: Thu, 14 Sep 2023 17:24:12 -0400 Subject: [PATCH] Fix #9772 --- CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp index d64c8a25b7..b2ea69dcc5 100644 --- a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp @@ -54925,8 +54925,11 @@ int CvDiplomacyAIHelpers::GetCityLiberationValue(CvCity* pCity, PlayerTypes eLib if (!bHisGainIsOurOwn) { + // Need to check if the opponent is alive, calling this for an unmet player can crash the game + StrengthTypes eOpponentStrength = GET_PLAYER(eNewOwner).isAlive() ? pDiplo->GetMilitaryStrengthComparedToUs(eNewOwner) : STRENGTH_PATHETIC; + // DECREASE if opponent is big and nasty. - switch (pDiplo->GetMilitaryStrengthComparedToUs(eNewOwner)) + switch (eOpponentStrength) { case NO_STRENGTH_VALUE: UNREACHABLE(); // Strengths are supposed to have been evaluated by this point.