From c27bf325ad7be1a6b77d4b02949dd0d52380bdce Mon Sep 17 00:00:00 2001
From: biwa <6475593+biwa@users.noreply.github.com>
Date: Sat, 20 Feb 2021 13:11:03 +0100
Subject: [PATCH] Added safeguard to MapSet.NearestLinedefRange if selectionmap
is null. Might fix #529.
---
Source/Core/Map/MapSet.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs
index bf891eb..89be2b6 100644
--- a/Source/Core/Map/MapSet.cs
+++ b/Source/Core/Map/MapSet.cs
@@ -3387,6 +3387,9 @@ namespace CodeImp.DoomBuilder.Map
/// This finds the line closest to the specified position.
public static Linedef NearestLinedefRange(BlockMap selectionmap, Vector2D pos, float maxrange) //mxd
{
+ if (selectionmap == null)
+ return null;
+
Linedef closest = null;
float distance = float.MaxValue;
float maxrangesq = maxrange * maxrange;