From 346070c51db4d343fa02b8957cb99fc769c828dd Mon Sep 17 00:00:00 2001 From: geemili Date: Thu, 15 Feb 2024 23:02:46 -0700 Subject: [PATCH] fix: check for a card in the stack before checking rank --- solitaire.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solitaire.lua b/solitaire.lua index fa02df6..df1170e 100644 --- a/solitaire.lua +++ b/solitaire.lua @@ -335,7 +335,7 @@ function update() local has_won=true for i=3,6 do local stack=stacks[i] - has_won=(has_won and stack[#stack].rank>=13) + has_won=(has_won and #stack>0 and stack[#stack].rank>=13) end if has_won then pmem(WIN_COUNT_SLOT, pmem(WIN_COUNT_SLOT) + 1)