From c750369ad08b34148d730c0756d48a63a819bebd Mon Sep 17 00:00:00 2001 From: KungCheops Date: Sun, 9 Jun 2024 15:30:55 +0200 Subject: [PATCH] Fix crash (#10959) --- CvGameCoreDLL_Expansion2/CvPlot.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CvGameCoreDLL_Expansion2/CvPlot.cpp b/CvGameCoreDLL_Expansion2/CvPlot.cpp index f07d17817b..c8284941fd 100644 --- a/CvGameCoreDLL_Expansion2/CvPlot.cpp +++ b/CvGameCoreDLL_Expansion2/CvPlot.cpp @@ -3352,14 +3352,19 @@ int CvPlot::getFeatureProduction(BuildTypes eBuild, PlayerTypes ePlayer, CvCity* return 0; } - *ppCity = getEffectiveOwningCity(); + CvCity* pEffectiveOwningCity = getEffectiveOwningCity(); - if(*ppCity == NULL) + if(pEffectiveOwningCity == NULL) { - *ppCity = GC.getMap().findCity(getX(), getY(), NO_PLAYER, eTeam, false); + pEffectiveOwningCity = GC.getMap().findCity(getX(), getY(), NO_PLAYER, eTeam, false); } - if(*ppCity == NULL) + if (ppCity) + { + *ppCity = pEffectiveOwningCity; + } + + if(pEffectiveOwningCity == NULL) { return 0; }