From 547aec7541f66032331c100c140359ff6ac59731 Mon Sep 17 00:00:00 2001
From: biwa <6475593+biwa@users.noreply.github.com>
Date: Thu, 22 Apr 2021 16:12:14 +0200
Subject: [PATCH] Sectors Mode: potentially fixed some crashes related to
 determining thing sectors

---
 Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
index 2a38520b5..c72d780af 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
@@ -2018,6 +2018,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 
 				// Recreate the blockmap since it shouldn't include the deleted sectors anymore
 				CreateBlockmap();
+
+				// Clear the cache of things that already got their sector determined
+				determinedsectorthings = new HashSet<Thing>();
 			}
 
 			if(selectedthings.Count > 0 || selectedsectors.Count > 0)
@@ -2077,6 +2080,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 				// Recreate the blockmap
 				CreateBlockmap();
 
+				// Clear the cache of things that already got their sector determined
+				determinedsectorthings = new HashSet<Thing>();
+
 				//mxd. Update
 				UpdateOverlaySurfaces();
 				UpdateEffectLabels();
@@ -2122,6 +2128,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 				// Recreate the blockmap
 				CreateBlockmap();
 
+				// Clear the cache of things that already got their sector determined
+				determinedsectorthings = new HashSet<Thing>();
+
 				//mxd. Update
 				UpdateOverlaySurfaces();
 				UpdateEffectLabels();
-- 
GitLab