From 77ba424fdd7e2b447151826f37bc312b7cc58771 Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Sun, 2 Nov 2014 17:15:04 +0000
Subject: [PATCH] Fixed: it's now impossible to set grid size smaller than 1.

---
 Source/Core/Editing/GridSetup.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Source/Core/Editing/GridSetup.cs b/Source/Core/Editing/GridSetup.cs
index a25593fb6..2f0df40b0 100644
--- a/Source/Core/Editing/GridSetup.cs
+++ b/Source/Core/Editing/GridSetup.cs
@@ -33,6 +33,7 @@ namespace CodeImp.DoomBuilder.Editing
 		#region ================== Constants
 
 		private const int DEFAULT_GRID_SIZE = 32;
+		private const int MINIMUM_GRID_SIZE = 1; //mxd
 
 		public const int SOURCE_TEXTURES = 0;
 		public const int SOURCE_FLATS = 1;
@@ -147,6 +148,9 @@ namespace CodeImp.DoomBuilder.Editing
 		// This sets the grid size
 		internal void SetGridSize(int size)
 		{
+			//mxd. Bad things happen when size <= 0
+			size = Math.Max(size, MINIMUM_GRID_SIZE);
+			
 			// Change grid
 			this.gridsize = size;
 			this.gridsizef = gridsize;
-- 
GitLab