chiark / gitweb /
Fix a memory error in Guess cursor handling.
authorJonas Kölker <jonaskoelker@yahoo.com>
Thu, 1 Oct 2015 12:00:47 +0000 (14:00 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Oct 2015 15:59:10 +0000 (16:59 +0100)
guess.c

diff --git a/guess.c b/guess.c
index 1470426e1dc1dcb5e7a59bf6e15d4acd573aa634..5a53b01bf7ad9d9bbaa847a9213bb98b41153363 100644 (file)
--- a/guess.c
+++ b/guess.c
@@ -777,6 +777,8 @@ static char *interpret_move(const game_state *from, game_ui *ui,
         set_peg(&from->params, ui, ui->peg_cur, 0);
         ret = "";
     } else if (button == 'H' || button == 'h') {
+        if (ui->peg_cur == from->params.npegs)
+            return NULL;
         ui->display_cur = 1;
         ui->holds[ui->peg_cur] = 1 - ui->holds[ui->peg_cur];
         ret = "";