Fixed crash when setting a filter while the game is refreshing the server list

This commit is contained in:
juanjp600
2017-12-03 20:33:20 -03:00
parent f8e5a4f7ab
commit 4a1eea8c30
3 changed files with 25 additions and 48 deletions
@@ -259,29 +259,21 @@ namespace Barotrauma
if (!Visible) return;
if (ComponentsToUpdate.Contains(this)) return;
ComponentsToUpdate.Add(this);
try
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
int lastVisible = 0;
for (int i = 0; i < fixedChildren.Count; i++)
{
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
int lastVisible = 0;
for (int i = 0; i < fixedChildren.Count; i++)
if (fixedChildren[i] == frame) continue;
if (!IsChildVisible(fixedChildren[i]))
{
if (fixedChildren[i] == frame) continue;
if (!IsChildVisible(fixedChildren[i]))
{
if (lastVisible > 0) break;
continue;
}
lastVisible = i;
fixedChildren[i].AddToGUIUpdateList();
if (lastVisible > 0) break;
continue;
}
}
catch (Exception e)
{
DebugConsole.NewMessage("Error in AddToGUIUpdateList! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
throw;
lastVisible = i;
fixedChildren[i].AddToGUIUpdateList();
}
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();