diff options
| author | historia <[not public]> | 2026-09-18 15:16:44 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 15:16:44 -0400 |
| commit | 7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch) | |
| tree | 902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/casino/cards.go | |
| parent | 153acb7f644d755c45533b7c5311e3ffa47e8973 (diff) | |
| download | thehouseoficarus-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.go | 8 |
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 |
