From c45a256816752909cec68529107f7e4f7e0f7fd2 Mon Sep 17 00:00:00 2001 From: dydzio Date: Sat, 10 Dec 2016 13:34:58 +0100 Subject: [PATCH] Further fix for mantis #2599 --- lib/CGameInfoCallback.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index 0f091b894..a5b9a3dc3 100644 --- a/lib/CGameInfoCallback.cpp +++ b/lib/CGameInfoCallback.cpp @@ -269,18 +269,19 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero const CGHeroInstance *h = dynamic_cast(hero); ERROR_RET_VAL_IF(!h, "That's not a hero!", false); - ERROR_RET_VAL_IF(!isVisible(h->getPosition(false)), "That hero is not visible!", false); InfoAboutHero::EInfoLevel infoLevel = InfoAboutHero::EInfoLevel::BASIC; if(hasAccess(h->tempOwner)) infoLevel = InfoAboutHero::EInfoLevel::DETAILED; - if ( (infoLevel == InfoAboutHero::EInfoLevel::BASIC) && gs->curB) //if it's battle we can get enemy hero full data + if (infoLevel == InfoAboutHero::EInfoLevel::BASIC) { - if(gs->curB->playerHasAccessToHeroInfo(*player, h)) + if(gs->curB && gs->curB->playerHasAccessToHeroInfo(*player, h)) //if it's battle we can get enemy hero full data infoLevel = InfoAboutHero::EInfoLevel::INBATTLE; - } + else + ERROR_RET_VAL_IF(!isVisible(h->getPosition(false)), "That hero is not visible!", false); + } if( (infoLevel == InfoAboutHero::EInfoLevel::BASIC) && nullptr != selectedObject) {