Fix Game List highlighting (WB)
[xboard.git] / winboard / wgamelist.c
index dda29d0..a3c96be 100644 (file)
@@ -1,7 +1,8 @@
 /*\r
  * wgamelist.c -- Game list window for WinBoard\r
  *\r
- * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.\r
+ * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free\r
+ * Software Foundation, Inc.\r
  *\r
  * Enhancements Copyright 2005 Alessandro Scotti\r
  *\r
@@ -438,7 +439,7 @@ VOID GameListHighlight(int index)
         res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, i, (LPARAM)buf );\r
         if(res == LB_ERR || index < atoi( buf )) break;\r
   }\r
-  j = i/2;\r
+  j = (i == 64 ? 0 : i/2);\r
   while(i-j > 1) {\r
         n = (i + j) >> 1;\r
         res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, n, (LPARAM)buf );\r