network_gui.c
changeset 5247 1f982de55b88
parent 5125 d1331d6dbdcb
child 5339 96ac3f4933bb
--- a/network_gui.c	Tue Dec 05 12:17:31 2006 +0000
+++ b/network_gui.c	Tue Dec 05 13:58:20 2006 +0000
@@ -1490,7 +1490,9 @@
 	}
 
 	/* Then, try townnames */
-	if (*item < (uint)MAX_CLIENT_INFO + GetTownArraySize()) {
+	/* Not that the following assumes all town indices are adjacent, ie no
+	 * towns have been deleted. */
+	if (*item <= (uint)MAX_CLIENT_INFO + GetMaxTownIndex()) {
 		const Town *t;
 
 		FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_INFO) {