From 2f1aae59ebad00f17e1d6e97c0eb9e2b27b84fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 22 Mar 2015 18:18:19 +0100 Subject: [PATCH] don't crash so easily --- OpenRA.Game/Map/TileSet.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Map/TileSet.cs b/OpenRA.Game/Map/TileSet.cs index 1c26b33c27..613864956a 100644 --- a/OpenRA.Game/Map/TileSet.cs +++ b/OpenRA.Game/Map/TileSet.cs @@ -246,7 +246,9 @@ namespace OpenRA public byte GetTerrainIndex(TerrainTile r) { - var tpl = Templates[r.Type]; + TerrainTemplateInfo tpl; + if (!Templates.TryGetValue(r.Type, out tpl)) + return defaultWalkableTerrainIndex; if (tpl.Contains(r.Index)) {