浏览代码

Update client/adventureMap/CList.cpp

Co-authored-by: Nordsoft91 <[email protected]>
Laserlicht 2 年之前
父节点
当前提交
f3262a47c0
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      client/adventureMap/CList.cpp

+ 3 - 3
client/adventureMap/CList.cpp

@@ -374,10 +374,10 @@ void CTownList::CTownItem::gesture(bool on, const Point & initialPosition, const
 	if(!on)
 		return;
 
-	if(!LOCPLINT->localState->getOwnedTowns()[townPos])
-		return;
-
 	const std::vector<const CGTownInstance *> towns = LOCPLINT->localState->getOwnedTowns();
+	
+	if(townPos < 0 || townPos > towns.size() - 1 || !towns[townPos])
+		return;
 
 	if(towns.size() < 2)
 		return;