Skip to content

Commit

Permalink
If deck is nil, then Copy should return a nil Deck
Browse files Browse the repository at this point in the history
  • Loading branch information
zchenyu committed Apr 25, 2021
1 parent e080b3a commit 5aa0bb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deck.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func NewDeck() *Deck {
}

func (deck *Deck) Copy() *Deck {
if deck == nil {
return nil
}
deck2 := &Deck{
cards: make([]Card, len(deck.cards)),
}
Expand Down

0 comments on commit 5aa0bb5

Please sign in to comment.