Fix nil dereference.

This commit is contained in:
2023-04-03 01:40:47 -07:00
parent 47fa7c3d6b
commit c798ba31e1

View File

@ -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