aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/cards.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 15:16:44 -0400
committerhistoria <[not public]>2026-09-18 15:16:44 -0400
commit7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch)
tree902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/casino/cards.go
parent153acb7f644d755c45533b7c5311e3ffa47e8973 (diff)
downloadthehouseoficarus-7eab582d8a8ee2af1a6baae7baf0696c7005de2e.tar.gz
fix: harden triggers, economy, casino, world data, and admin/net paths
Diffstat (limited to 'internal/casino/cards.go')
-rw-r--r--internal/casino/cards.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/casino/cards.go b/internal/casino/cards.go
index 27da8aa..2d53b4a 100644
--- a/internal/casino/cards.go
+++ b/internal/casino/cards.go
@@ -73,6 +73,14 @@ func (s *shoe) remaining() int { return len(s.cards) }
func (s *shoe) draw() card {
if len(s.cards) == 0 {
+ if s.decks <= 0 {
+ // A synthetic, explicitly-scripted shoe (tests) has no decks to
+ // rebuild from and no cards left; return a visibly-invalid sentinel
+ // card rather than panicking. Production shoes always have Decks >
+ // 0 (Normalize), so this only surfaces a test fixture that drew
+ // past its script.
+ return card{rank: "?", suit: "?"}
+ }
// Shuffle-through: if the shoe runs out mid-round it is rebuilt from
// all decks, so a card already dealt this round can reappear. This
// matches real blackjack, where an exhausted shoe is shuffled through