1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Merge pull request #4982 from kdmcser/fix_dismiss_crash

crash fix: dismiss hero when pick artifact
This commit is contained in:
Ivan Savenko 2024-11-27 16:41:44 +02:00 committed by GitHub
commit c3494b4a73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -140,6 +140,8 @@ void CArtifactsOfHeroBase::gestureArtPlace(CComponentHolder & artPlace, const Po
void CArtifactsOfHeroBase::setHero(const CGHeroInstance * hero)
{
curHero = hero;
if (!hero)
return;
for(auto slot : artWorn)
{

View File

@ -28,7 +28,8 @@ CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position)
CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
{
CArtifactsOfHeroBase::putBackPickedArtifact();
if(curHero)
CArtifactsOfHeroBase::putBackPickedArtifact();
}
void CArtifactsOfHeroMain::keyPressed(EShortcut key)

View File

@ -312,6 +312,7 @@ void CHeroWindow::dismissCurrent()
arts->putBackPickedArtifact();
close();
LOCPLINT->cb->dismissHero(curHero);
arts->setHero(nullptr);
}, nullptr);
}