1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Try to fix crash on transferring component of a composite artifact

This commit is contained in:
Ivan Savenko 2024-08-02 15:56:05 +00:00
parent c9b6b17422
commit 13108849ca

View File

@ -130,13 +130,15 @@ void CGameStateCampaign::trimCrossoverHeroesParameters(const CampaignTravel & tr
if(!art)
return false;
bool takeable = travelOptions.artifactsKeptByHero.count(art->artType->getId());
ArtifactLocation al(hero.hero->id, artifactPosition);
if (takeable)
bool takeable = travelOptions.artifactsKeptByHero.count(art->artType->getId());
bool locked = hero.hero->getSlot(al.slot)->locked;
if (!locked && takeable)
hero.transferrableArtifacts.push_back(artifactPosition);
ArtifactLocation al(hero.hero->id, artifactPosition);
if(!takeable && !hero.hero->getSlot(al.slot)->locked) //don't try removing locked artifacts -> it crashes #1719
if (!locked && !takeable)
{
hero.hero->getArt(al.slot)->removeFrom(*hero.hero, al.slot);
return true;