Fixed a crash occurring on token clone (e.g. Doubling Season) as described in the issue #1040.
This commit is contained in:
@@ -4167,7 +4167,6 @@ public:
|
|||||||
spell->source->isToken = 1;
|
spell->source->isToken = 1;
|
||||||
spell->source->fresh = 1;
|
spell->source->fresh = 1;
|
||||||
spell->source->entersBattlefield = 1;
|
spell->source->entersBattlefield = 1;
|
||||||
spell->source->tokCard = spell->source->clone();
|
|
||||||
if(spell->source->getMTGId() == 0)
|
if(spell->source->getMTGId() == 0)
|
||||||
{//fix missing art: if token creator is put inside ability$!!$ who, then try to get the stored source card
|
{//fix missing art: if token creator is put inside ability$!!$ who, then try to get the stored source card
|
||||||
if(((MTGCardInstance*)source)->storedSourceCard)
|
if(((MTGCardInstance*)source)->storedSourceCard)
|
||||||
@@ -4177,6 +4176,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
spell->resolve();
|
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;
|
myToken = spell->source;
|
||||||
if(aLivingWeapon)
|
if(aLivingWeapon)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4636,7 +4636,8 @@ int AACloner::resolve()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
clone = _target->tokCard;
|
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
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user