From 859dc1c2044140f7bae42705940e44b4c94bd07e Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 21 Dec 2018 10:22:22 +0000 Subject: Fixed SEGV when trying to move an empty column. --- Makefile | 2 +- csol.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9f2b522..1002baa 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ LIBS=-lcurses csol: csol.c - $(CC) -o csol csol.c $(LIBS) + $(CC) -g -o csol csol.c $(LIBS) clean: -rm -f csol csol.exe core diff --git a/csol.c b/csol.c index d305c13..f07e755 100644 --- a/csol.c +++ b/csol.c @@ -696,14 +696,16 @@ static void Klondike(int draw) { int can_move = FALSE; - if (column_up[move_pos_x].card[move_pos_y].value == 13 && + if (column_up[move_pos_x].no && + column_up[move_pos_x].card[move_pos_y].value == 13 && column_up[pos_x].no == 0 && column_down[pos_x].no == 0) { can_move = TRUE; } else { - if (CanCardSitOnTop + if (column_up[move_pos_x].no && + CanCardSitOnTop (column_up[move_pos_x].card[move_pos_y], TopOfPile(&column_up[pos_x]))) { -- cgit v1.2.3