From e6743d93633754d9375b7e0cda342d63f1034104 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 6 Apr 2021 15:59:54 +0300 Subject: [PATCH 49/49] 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/city.c b/common/city.c index 785e335488..c0d7ab334e 100644 --- a/common/city.c +++ b/common/city.c @@ -2815,6 +2815,15 @@ inline void set_city_production(struct city *pcity) struct city *tcity = game_city_by_number(proute->partner); bool can_trade; + /* 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 (!is_server() + && (tcity == NULL + || city_owner(tcity)->slot == NULL)) { + continue; + } + fc_assert_action(tcity != NULL, continue); can_trade = can_cities_trade(pcity, tcity); -- 2.30.2