GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit b3dc0d24 authored by Jitnaught's avatar Jitnaught
Browse files

Fix exception when ropes are deleted due to bad entity

parent 1b1eee82
......@@ -116,13 +116,20 @@ namespace RopeCreator
{
if (Game.GameTime >= nextDeleteBadRopes)
{
bool deletedOne = false;
foreach (var group in ropeGroups)
{
group.DeleteRopesWithBadEntity();
if (group.DeleteRopesWithBadEntity())
{
deletedOne = true;
}
Yield();
}
if (deletedOne) Menu.ReloadRopeIndices();
nextDeleteBadRopes = Game.GameTime + 1000;
}
}
......
......@@ -85,9 +85,11 @@ namespace RopeCreator
return true;
}
internal void DeleteRopesWithBadEntity()
internal bool DeleteRopesWithBadEntity()
{
if (ropes.Count == 0) return;
if (ropes.Count == 0) return false;
bool deletedOne = false;
for (int i = 0; i < ropes.Count; i++)
{
......@@ -99,8 +101,12 @@ namespace RopeCreator
rope.Delete();
ropes.RemoveAt(i);
i--;
deletedOne = true;
}
}
return deletedOne;
}
internal void ReattachRagdollPeds()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment