浏览代码

fix crash if second level does not exists

Laserlicht 1 周之前
父节点
当前提交
4ea3a26f8f
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lib/mapObjects/MiscObjects.cpp

+ 3 - 2
lib/mapObjects/MiscObjects.cpp

@@ -535,8 +535,9 @@ void CGSubterraneanGate::postInit(IGameInfoCallback * cb) //matches subterranean
 	}
 
 	// we should assign empty channels to underground gates if they don't have matching overground gates
-	for(auto & i : gatesSplit[1])
-		assignToChannel(i);
+	if(gatesSplit.size() > 1)
+		for(auto & i : gatesSplit[1])
+			assignToChannel(i);
 }
 
 void CGWhirlpool::onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const