network_gui.c
changeset 5247 c3eece01af11
parent 5125 60b21cf18b50
child 5339 7573f179efe8
--- 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) {