(74c45abbe) Fixed: GUIDropdown parent returning a null GUIComponent when opening CharacterEditor & promptly crashing after
This commit is contained in:
@@ -148,7 +148,14 @@ namespace Barotrauma
|
|||||||
//find the parent GUIListBox highest in the hierarchy
|
//find the parent GUIListBox highest in the hierarchy
|
||||||
for (int i = parentHierarchy.Count - 1; i >= 0; i--)
|
for (int i = parentHierarchy.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (parentHierarchy[i].GUIComponent is GUIListBox) return parentHierarchy[i]?.Parent ?? parentHierarchy[i];
|
if (parentHierarchy[i].GUIComponent is GUIListBox)
|
||||||
|
{
|
||||||
|
if (parentHierarchy[i].Parent != null && parentHierarchy[i].Parent.GUIComponent != null)
|
||||||
|
{
|
||||||
|
return parentHierarchy[i].Parent;
|
||||||
|
}
|
||||||
|
return parentHierarchy[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//or just go with the direct parent if there are no listboxes in the hierarchy
|
//or just go with the direct parent if there are no listboxes in the hierarchy
|
||||||
parentHierarchy.Clear();
|
parentHierarchy.Clear();
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ToolBox.IsProperFilenameCase(file);
|
ToolBox.IsProperFilenameCase(file);
|
||||||
doc = XDocument.Load(file, LoadOptions.SetBaseUri);
|
doc = XDocument.Load(file, LoadOptions.SetBaseUri);
|
||||||
if (doc == null) { throw new Exception("doc is null"); }
|
|
||||||
if (doc.Root == null) { throw new Exception("doc.Root is null"); }
|
|
||||||
if (doc.Root.Elements() == null) { throw new Exception("doc.Root.Elements() is null"); }
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -116,34 +113,26 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void RescaleFonts()
|
private void RescaleFonts()
|
||||||
{
|
{
|
||||||
if (configElement == null) { return; }
|
|
||||||
if (configElement.Elements() == null) { return; }
|
|
||||||
foreach (XElement subElement in configElement.Elements())
|
foreach (XElement subElement in configElement.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "font":
|
case "font":
|
||||||
if (Font == null) { continue; }
|
|
||||||
Font.Size = GetFontSize(subElement);
|
Font.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "smallfont":
|
case "smallfont":
|
||||||
if (SmallFont == null) { continue; }
|
|
||||||
SmallFont.Size = GetFontSize(subElement);
|
SmallFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "largefont":
|
case "largefont":
|
||||||
if (LargeFont == null) { continue; }
|
|
||||||
LargeFont.Size = GetFontSize(subElement);
|
LargeFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "objectivetitle":
|
case "objectivetitle":
|
||||||
if (ObjectiveTitleFont == null) { continue; }
|
|
||||||
ObjectiveTitleFont.Size = GetFontSize(subElement);
|
ObjectiveTitleFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "objectivename":
|
case "objectivename":
|
||||||
if (ObjectiveNameFont == null) { continue; }
|
|
||||||
ObjectiveNameFont.Size = GetFontSize(subElement);
|
ObjectiveNameFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "videotitle":
|
case "videotitle":
|
||||||
if (VideoTitleFont == null) { continue; }
|
|
||||||
VideoTitleFont.Size = GetFontSize(subElement);
|
VideoTitleFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
|
if (Rand.Range(0.0f, 1.0f) < 0.5f)//listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
|
||||||
{
|
{
|
||||||
new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: TextManager.Get("WorkshopItemUpdate"))
|
new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: TextManager.Get("WorkshopItemUpdate"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server. You can see the IDs of the clients using the command \"clientlist\".", (string[] args) =>
|
commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server.", (string[] args) =>
|
||||||
{
|
{
|
||||||
if (GameMain.NetworkMember == null || args.Length == 0) return;
|
if (GameMain.NetworkMember == null || args.Length == 0) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user