From bd9dff8fe6846704fecbc1f35018026cee638d37 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 28 Feb 2008 21:17:46 -0800 Subject: [PATCH] Ignore clicks outside the current board This prevents crashing and moving pieces off of the board. --- loa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loa.c b/loa.c index 5716a36..355c667 100644 --- a/loa.c +++ b/loa.c @@ -80,6 +80,13 @@ on_button_press_event (GtkWidget *widget, return TRUE; } + /* Do nothing for out-of-bounds clicks */ + if (x < 0 || x >= LOA_BOARD_SIZE || + y < 0 || y >= LOA_BOARD_SIZE) + { + return TRUE; + } + if (x == game->selected_x && y == game->selected_y) { -- 2.43.0