Guard drag-ok? so it handles the empty list properly
change suggested by Stefan Schmiedl; closes PR 14164 It seems a bit strange that a region callback can be invoked when there are no cards, but looking at the card library it isn't obvious that the list is supposed to be non-empty, so probably better to just be "defensive" in this case, rather than attempting to tighten the contracts
This commit is contained in:
parent
fac70aa121
commit
4db57816fc
|
@ -195,12 +195,13 @@
|
|||
#f)))
|
||||
|
||||
(define (drag-ok? cards i)
|
||||
(let ([c (car cards)]
|
||||
[l (vector-ref stacks i)])
|
||||
(and l
|
||||
(or (null? l)
|
||||
(= (send (car l) get-value)
|
||||
(add1 (send c get-value)))))))
|
||||
(and (pair? cards)
|
||||
(let ([c (car cards)]
|
||||
[l (vector-ref stacks i)])
|
||||
(and l
|
||||
(or (null? l)
|
||||
(= (send (car l) get-value)
|
||||
(add1 (send c get-value))))))))
|
||||
|
||||
(let loop ([i 0])
|
||||
(unless (= i (vector-length stacks))
|
||||
|
|
Loading…
Reference in New Issue
Block a user