$OpenBSD: patch-src_init_c,v 1.1 2004/08/16 14:58:48 espie Exp $
--- src/init.c.orig	Fri May 19 10:44:14 1995
+++ src/init.c	Mon Aug 16 16:15:46 2004
@@ -225,7 +225,7 @@ short distance (short a, short b) 
 #else                
 short distance (short a, short b)
 {
-  return (use_distdata ? (short)(*distdata)[(int)a][(int)b] : (short)computed_distance(a,b));
+  return (use_distdata && a < NO_SQUARES && b < NO_SQUARES ? (short)(*distdata)[(int)a][(int)b] : (short)computed_distance(a,b));
 }
 #endif                         
 
