1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge pull request #2232 from wb180/fixCrashInVCAI

Okay, that's certainly a good change even if the code is quite messy otherwise.
This commit is contained in:
DjWarmonger 2023-06-15 15:20:38 +02:00 committed by GitHub
commit 71a4713df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{