mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Check against nullptr in VisitHero::fulfillsMe()
This commit is contained in:
@ -435,10 +435,18 @@ TSubgoal VisitHero::whatToDoToAchieve()
|
|||||||
|
|
||||||
bool VisitHero::fulfillsMe (TSubgoal goal)
|
bool VisitHero::fulfillsMe (TSubgoal goal)
|
||||||
{
|
{
|
||||||
if (goal->goalType == Goals::VISIT_TILE && cb->getObj(ObjectInstanceID(objid))->visitablePos() == goal->tile)
|
if (goal->goalType != Goals::VISIT_TILE)
|
||||||
return true;
|
{
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
auto obj = cb->getObj(ObjectInstanceID(objid));
|
||||||
|
if (!obj)
|
||||||
|
{
|
||||||
|
logAi->errorStream() << boost::format("Hero %s: VisitHero::fulfillsMe at %s: object %d not found")
|
||||||
|
% hero.name % goal->tile % objid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return obj->visitablePos() == goal->tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSubgoal GetArtOfType::whatToDoToAchieve()
|
TSubgoal GetArtOfType::whatToDoToAchieve()
|
||||||
|
Reference in New Issue
Block a user