Skip to content

Commit 4e614d6

Browse files
authored
Merge pull request #6 from nerai/coordinate_sanity_check
Coordinate sanity check
2 parents 583615e + 6285752 commit 4e614d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Board.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ public void SetContentAt(Point p, Content content)
230230
/// <param name="c">The new content at the position.</param>
231231
public void SetContentAt(int x, int y, Content c)
232232
{
233+
if (x < 0) {
234+
throw new ArgumentOutOfRangeException ("x", "Invalid x coordinate.");
235+
}
236+
if (y < 0) {
237+
throw new ArgumentOutOfRangeException ("y", "Invalid y coordinate.");
238+
}
233239
content[x, y] = c;
234240
ClearGroupCache();
235241
}

0 commit comments

Comments
 (0)