summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-12-21 10:22:22 +0000
committerIan C <ianc@noddybox.co.uk>2018-12-21 10:22:22 +0000
commit859dc1c2044140f7bae42705940e44b4c94bd07e (patch)
tree0da409b91968ba725f14ef34f8bc855ca2584fc1
parent3e4827768ddfe27fbacc1f0f1cec3bd8c891e001 (diff)
Fixed SEGV when trying to move an empty column.
-rw-r--r--Makefile2
-rw-r--r--csol.c6
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])))
{