Fixed a crash occurring on token clone (e.g. Doubling Season) as described in the issue #1040.

This commit is contained in:
valfieri
2020-11-18 15:22:25 +01:00
parent 42f2c34a46
commit 252e66736a
2 changed files with 3 additions and 2 deletions

View File

@@ -4167,7 +4167,6 @@ public:
spell->source->isToken = 1;
spell->source->fresh = 1;
spell->source->entersBattlefield = 1;
spell->source->tokCard = spell->source->clone();
if(spell->source->getMTGId() == 0)
{//fix missing art: if token creator is put inside ability$!!$ who, then try to get the stored source card
if(((MTGCardInstance*)source)->storedSourceCard)
@@ -4177,6 +4176,7 @@ public:
}
}
spell->resolve();
spell->source->tokCard = spell->source->clone(); // tokCard has to be assigned after Spell resolves in order to avoid the pointer is dereferenced. #ISSUE 1040
myToken = spell->source;
if(aLivingWeapon)
{

View File

@@ -4636,7 +4636,8 @@ int AACloner::resolve()
else
{
clone = _target->tokCard;
clone->data = _target->tokCard;//?wtf
if(clone) // Check if clone is not null to avoid null pointer exception. #ISSUE 1040
clone->data = _target->tokCard;//?wtf
}
}
else