From c798ba31e19ecddf276ae28d617923581987ff12 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Mon, 3 Apr 2023 01:40:47 -0700 Subject: [PATCH] Fix nil dereference. --- koboldsim/cardtypes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koboldsim/cardtypes.go b/koboldsim/cardtypes.go index d81a412..f4e7f4f 100644 --- a/koboldsim/cardtypes.go +++ b/koboldsim/cardtypes.go @@ -83,7 +83,7 @@ func (s *SwitchingCard) Options(*Player) ([]CardOption, error) { func (s *SwitchingCard) Then(p *Player, o CardOption) error { newPolicy := o.(Policy) var errs cardsim.ErrorCollector - if !newPolicy.Is(s.lastPolicy) { + if s.lastPolicy != nil && !newPolicy.Is(s.lastPolicy) { err := s.lastPolicy.Unenact(p) if cardsim.IsSeriousError(err) { return err