From 33c318b28feeb8d3c9e8540ba8816ea4bfe4db24 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 5 Apr 2023 06:43:35 +0300 Subject: [PATCH 33/33] Fix dead assignment of 'pcity' from unit_move() See osdn #47765 Signed-off-by: Marko Lindqvist --- server/unittools.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/unittools.c b/server/unittools.c index dd014cbe85..946bb43c5a 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -3845,7 +3845,8 @@ bool unit_move(struct unit *punit, struct tile *pdesttile, int move_cost, { struct player *pplayer; struct tile *psrctile; - struct city *pcity; + struct city *psrccity; + struct city *pdestcity; struct unit *ptransporter; struct packet_unit_info src_info, dest_info; struct packet_unit_short_info src_sinfo, dest_sinfo; @@ -4141,7 +4142,8 @@ bool unit_move(struct unit *punit, struct tile *pdesttile, int move_cost, /* Inform the owner's client about actor unit arrival. Can, depending on * the client settings, cause the client to start the process that makes * the action selection dialog pop up. */ - if ((pcity = tile_city(pdesttile))) { + pdestcity = tile_city(pdesttile); + if (pdestcity != NULL) { /* Arrival in a city counts. */ unit_move_data_list_iterate(plist, pmove_data) { @@ -4214,13 +4216,13 @@ bool unit_move(struct unit *punit, struct tile *pdesttile, int move_cost, } unit_move_data_list_destroy(plist); - /* Check cities at source and destination. */ - if ((pcity = tile_city(psrctile))) { - refresh_dumb_city(pcity); + psrccity = tile_city(psrctile); + if (psrccity != NULL) { + refresh_dumb_city(psrccity); } - if ((pcity = tile_city(pdesttile))) { - refresh_dumb_city(pcity); + if (pdestcity != NULL) { + refresh_dumb_city(pdestcity); } if (unit_lives) { -- 2.39.2