From 59de9762ada7787d0840175b09b180d94f54309c Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Sun, 29 May 2022 10:47:00 +0200 Subject: [PATCH] Fixed two crashes that happened when trying to reset the grid transform, or toggling the grid visibility while no map was opened --- Source/Core/Windows/MainForm.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 75d5ed07..adfebeb9 100755 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -3052,6 +3052,9 @@ namespace CodeImp.DoomBuilder.Windows [BeginAction("togglegrid")] protected void ToggleGrid() { + if (General.Map == null) + return; + General.Settings.RenderGrid = !General.Settings.RenderGrid; itemtogglegrid.Checked = General.Settings.RenderGrid; buttontogglegrid.Checked = General.Settings.RenderGrid; @@ -3103,6 +3106,9 @@ namespace CodeImp.DoomBuilder.Windows [BeginAction("resetgrid")] protected void ResetGrid() { + if (General.Map == null) + return; + General.Map.Grid.SetGridRotation(0.0f); General.Map.Grid.SetGridOrigin(0, 0); General.Map.CRenderer2D.GridVisibilityChanged();