mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Fix crash on removing object during visit
This commit is contained in:
parent
ad25bfb4bb
commit
f92af94f19
@ -140,13 +140,11 @@ void Rewardable::Interface::grantRewardAfterLevelup(IGameCallback * cb, const Re
|
||||
caster.setActualCaster(hero);
|
||||
caster.setSpellSchoolLevel(info.reward.spellCast.second);
|
||||
cb->castSpell(&caster, info.reward.spellCast.first, int3{-1, -1, -1});
|
||||
|
||||
if(info.reward.removeObject)
|
||||
logMod->warn("Removal of object with spell casts is not supported!");
|
||||
}
|
||||
else if(info.reward.removeObject) //FIXME: object can't track spell cancel or finish, so removeObject leads to crash
|
||||
|
||||
if(info.reward.removeObject)
|
||||
if(auto * instance = dynamic_cast<const CGObjectInstance*>(this))
|
||||
cb->removeObject(instance);
|
||||
cb->removeAfterVisit(instance);
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
Loading…
Reference in New Issue
Block a user