From c154b63ad4882fb11e5b5deb3339c757e6c0eb5a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 8 Apr 2021 14:19:39 +0300 Subject: [PATCH 21/21] Fix CM crash when the other end of the trade route is not yet known Reported by alain_bkr See osdn #41926 Signed-off-by: Marko Lindqvist --- common/city.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/city.c b/common/city.c index 8880455246..a79bfcd5a1 100644 --- a/common/city.c +++ b/common/city.c @@ -2619,7 +2619,10 @@ inline void set_city_production(struct city *pcity) for (i = 0; i < MAX_TRADE_ROUTES; i++) { struct city *tcity = game_city_by_number(pcity->trade[i]); - if (tcity != NULL) { + /* Partner city may have not yet been sent to the client, or + * there's just a placeholder city with a placeholder owner + * created for some tile->worked. */ + if (tcity != NULL && city_owner(tcity)->slot != NULL) { bool can_trade = can_cities_trade(pcity, tcity); if (!can_trade) { -- 2.30.2