Browse Source

Merge pull request #262 from dydzio0614/patch-2

Further fix for mantis #2599
ArseniyShestakov 8 years ago
parent
commit
75461cfa0f
1 changed files with 5 additions and 4 deletions
  1. 5 4
      lib/CGameInfoCallback.cpp

+ 5 - 4
lib/CGameInfoCallback.cpp

@@ -269,18 +269,19 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
 	const CGHeroInstance *h = dynamic_cast<const CGHeroInstance *>(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)
 	{