Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Fixed infinite loop when deleting groups/entities
Browse files Browse the repository at this point in the history
  • Loading branch information
LogicAndTrick committed Apr 19, 2014
1 parent c2d7cc7 commit a03b6cd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ public virtual void Perform(Document document)
do
{
// Exclude world objects, but we want to remove Group and (brush) Entity objects as they are invalid if empty.
emptyParents = objects.Where(x => x.Parent != null && !(x.Parent is World) && x.Parent.Children.All(objects.Contains)).ToList();
emptyParents = objects.Where(x => x.Parent != null && !(x.Parent is World) && x.Parent.Children.All(objects.Contains) && !objects.Contains(x.Parent)).ToList();
foreach (var ep in emptyParents)
{
// Add the parent object into the delete list
if (!objects.Contains(ep.Parent)) objects.Add(ep.Parent);
objects.Add(ep.Parent);
}
} while (emptyParents.Any()); // If we changed the collection, we need to re-check

Expand Down

1 comment on commit a03b6cd

@valera6285
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.