From fa5568e21ac7365ebf9e68103cbd69122f040aec Mon Sep 17 00:00:00 2001 From: RecursiveVision <66801010+RecursiveVision@users.noreply.github.com> Date: Wed, 10 Jul 2024 02:44:04 -0400 Subject: [PATCH] Fix null pointer crash in Community Patch only --- CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp | 5 +++-- CvGameCoreDLL_Expansion2/CvReligionClasses.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp index e78285a083..9e073f1081 100644 --- a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp @@ -18434,7 +18434,7 @@ void CvDiplomacyAI::SelectBestApproachTowardsMajorCiv(PlayerTypes ePlayer, bool } } } - else + else if (pReligion) { eController = pReligion->m_eFounder; } @@ -47809,6 +47809,7 @@ int CvDiplomacyAI::GetReligionScore(PlayerTypes ePlayer) // Someone else's? else { + // Who controls the Holy City? PlayerTypes eController = NO_PLAYER; const CvReligion* pReligion = GC.getGame().GetGameReligions()->GetReligion(eTheirStateReligion, NO_PLAYER); if (MOD_BALANCE_VP) @@ -47822,7 +47823,7 @@ int CvDiplomacyAI::GetReligionScore(PlayerTypes ePlayer) } } } - else + else if (pReligion) { eController = pReligion->m_eFounder; } diff --git a/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp b/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp index dbd4c41dce..735e24918e 100644 --- a/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp +++ b/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp @@ -11721,7 +11721,7 @@ bool CvReligionAIHelpers::PassesTeammateReligionCheck(ReligionTypes eReligion, P } } } - else + else if (pReligion) { eController = pReligion->m_eFounder; }