diff --git a/client/widgets/CArtifactsOfHeroBase.cpp b/client/widgets/CArtifactsOfHeroBase.cpp index 7113f114b..36c0690f4 100644 --- a/client/widgets/CArtifactsOfHeroBase.cpp +++ b/client/widgets/CArtifactsOfHeroBase.cpp @@ -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) { diff --git a/client/widgets/CArtifactsOfHeroMain.cpp b/client/widgets/CArtifactsOfHeroMain.cpp index 9ca0ecc23..34458351e 100644 --- a/client/widgets/CArtifactsOfHeroMain.cpp +++ b/client/widgets/CArtifactsOfHeroMain.cpp @@ -28,7 +28,8 @@ CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position) CArtifactsOfHeroMain::~CArtifactsOfHeroMain() { - CArtifactsOfHeroBase::putBackPickedArtifact(); + if(curHero) + CArtifactsOfHeroBase::putBackPickedArtifact(); } void CArtifactsOfHeroMain::keyPressed(EShortcut key) diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index 1cd49584f..ad73c3960 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -312,6 +312,7 @@ void CHeroWindow::dismissCurrent() arts->putBackPickedArtifact(); close(); LOCPLINT->cb->dismissHero(curHero); + arts->setHero(nullptr); }, nullptr); }