From ab7706073bce31dcf0d3cca0a21b31587430e0c7 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 19 Apr 2015 15:10:17 +1200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20crash=20when=20asking=20for=20t?= =?UTF-8?q?he=20offset=20of=20an=20invalid=20subcell.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenRA.Game/Map/Map.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 21231eb144..251fef22bc 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -190,7 +190,13 @@ namespace OpenRA public Bitmap CustomPreview; public bool InvalidCustomRules { get; private set; } - public WVec OffsetOfSubCell(SubCell subCell) { return SubCellOffsets[(int)subCell]; } + public WVec OffsetOfSubCell(SubCell subCell) + { + if (subCell == SubCell.Invalid || subCell == SubCell.Any) + return WVec.Zero; + + return SubCellOffsets[(int)subCell]; + } [FieldLoader.LoadUsing("LoadOptions")] public MapOptions Options;