Browse Source

Merge pull request #2232 from wb180/fixCrashInVCAI

Okay, that's certainly a good change even if the code is quite messy otherwise.
DjWarmonger 2 years ago
parent
commit
71a4713df4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      AI/VCAI/Goals/CollectRes.cpp

+ 1 - 1
AI/VCAI/Goals/CollectRes.cpp

@@ -133,7 +133,7 @@ TSubgoal CollectRes::whatToDoToTrade()
 	ai->retrieveVisitableObjs(visObjs, true);
 	for(const CGObjectInstance * obj : visObjs)
 	{
-		if(const IMarket * m = IMarket::castFrom(obj, false); m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
+		if(const IMarket * m = IMarket::castFrom(obj, false); m && m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
 		{
 			if(obj->ID == Obj::TOWN)
 			{