From 22df516e11cd27d6e291175c19d6c4eae0be472d Mon Sep 17 00:00:00 2001
From: biwa <foracc@d00m.info>
Date: Sat, 20 Apr 2019 16:55:20 +0200
Subject: [PATCH] - Fixed a bug where moving the mouse outside the window could
 crash when pasting a selection while having auto dragging enabled. Fixes
 #110.

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

diff --git a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
index 1204e8e0b..9e63c3a33 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
@@ -394,6 +394,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		// This updates the selection
 		private void Update()
 		{
+			// biwa. This is a fix for autodrag, since it will actually fire OnMouseLeave and would crash when Update is called while the
+			// mouse is outside the window. This does *not* happen when dragging without autodrag.
+			if (!mouseinside) return;
+
 			// Not in any modifying mode?
 			if(mode == ModifyMode.None)
 			{
-- 
GitLab