From 21168ae7d015c575b89759c9f7b11c4d893ade08 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 4 Jul 2026 07:47:00 +0300
Subject: [PATCH 36/36] client: Clear city aarea references before destroying
 aareas

See RM #2072

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/packhand.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/client/packhand.c b/client/packhand.c
index 8c603580db..1fb7447ee2 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -5830,6 +5830,12 @@ void handle_access_area(const struct packet_access_area *packet)
 
   if (packet->index == 0) {
     /* First access area packet. Clear old set. */
+
+    /* Make sure no city refers to the old set. */
+    city_list_iterate(plr->cities, pcity) {
+      pcity->aarea = nullptr;
+    } city_list_iterate_end;
+
     area_list_clear_plr(plr);
 
     alist = aarea_list_new();
-- 
2.53.0

