Fix nil dereference.

This commit is contained in:
Kistaro Windrider 2023-04-03 01:40:47 -07:00
parent 47fa7c3d6b
commit c798ba31e1
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

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