From 6eb77d0bc063783482d7a3f69a83ac99de2b38ee Mon Sep 17 00:00:00 2001
From: boris_i <boris_i@e0d998f2-2e9b-42fe-843d-47128df60a06>
Date: Sun, 28 Jun 2009 14:47:21 +0000
Subject: [PATCH] Fixed a bug where flipping a line resulted in a crash, if its
 start vertex did not belong to any other line

---
 Source/Core/Map/Linedef.cs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs
index 67f25ffe1..1cecabcbc 100644
--- a/Source/Core/Map/Linedef.cs
+++ b/Source/Core/Map/Linedef.cs
@@ -547,11 +547,17 @@ namespace CodeImp.DoomBuilder.Map
 		// This flips the linedef's vertex attachments
 		public void FlipVertices()
 		{
+			// make sure the start/end vertices are not automatically
+			// deleted if they do not belong to any other line
+			General.Map.Map.AutoRemove = false;
+
 			// Flip vertices
 			Vertex oldstart = start;
 			Vertex oldend = end;
 			SetStartVertex(oldend);
 			SetEndVertex(oldstart);
+
+			General.Map.Map.AutoRemove = true;
 			
 			// For drawing, the interior now lies on the other side
 			frontinterior = !frontinterior;
-- 
GitLab