fixed crash on merging sectors together in which case one of the sectors only has lines adjacent to the others

This commit is contained in:
codeimp 2009-01-12 19:51:51 +00:00
parent 07113b5442
commit 3067dac119

View file

@ -122,9 +122,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
// Find the first sector that is not disposed
Sector first = null;
foreach(Sector s in orderedselection)
if(!s.IsDisposed) { first = s; break; }
// Join all selected sectors with the first // Join all selected sectors with the first
for(int i = 1; i < orderedselection.Count; i++) for(int i = 0; i < orderedselection.Count; i++)
orderedselection[i].Join(orderedselection[0]); if((orderedselection[i] != first) && !orderedselection[i].IsDisposed)
orderedselection[i].Join(first);
} }
// This highlights a new item // This highlights a new item