mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Merge pull request #4982 from kdmcser/fix_dismiss_crash
crash fix: dismiss hero when pick artifact
This commit is contained in:
@ -140,6 +140,8 @@ void CArtifactsOfHeroBase::gestureArtPlace(CComponentHolder & artPlace, const Po
|
|||||||
void CArtifactsOfHeroBase::setHero(const CGHeroInstance * hero)
|
void CArtifactsOfHeroBase::setHero(const CGHeroInstance * hero)
|
||||||
{
|
{
|
||||||
curHero = hero;
|
curHero = hero;
|
||||||
|
if (!hero)
|
||||||
|
return;
|
||||||
|
|
||||||
for(auto slot : artWorn)
|
for(auto slot : artWorn)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position)
|
|||||||
|
|
||||||
CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
|
CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
|
||||||
{
|
{
|
||||||
|
if(curHero)
|
||||||
CArtifactsOfHeroBase::putBackPickedArtifact();
|
CArtifactsOfHeroBase::putBackPickedArtifact();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +312,7 @@ void CHeroWindow::dismissCurrent()
|
|||||||
arts->putBackPickedArtifact();
|
arts->putBackPickedArtifact();
|
||||||
close();
|
close();
|
||||||
LOCPLINT->cb->dismissHero(curHero);
|
LOCPLINT->cb->dismissHero(curHero);
|
||||||
|
arts->setHero(nullptr);
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user