Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit 43bcf91

Browse files
committed
fix sectionless members
1 parent c5a82b2 commit 43bcf91

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

LegacyGUIManager.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private static void HandleMember(MemberAttribute member)
103103
}
104104
else return;
105105

106-
string highest = member.Parts.Length == 1 ? null : member.Parts[0];
106+
string highest = member.Parts.Length == 1 ? "Uncategorized" : member.Parts[0];
107107

108108
// this needs to be rewritten
109109
UIGroup lowest = null;
@@ -120,26 +120,27 @@ private static void HandleMember(MemberAttribute member)
120120
lowest.RegisterAsHighest();
121121
}
122122

123-
foreach (string section in member.Parts[1..^1])
124-
{
125-
bool found = false;
126-
127-
foreach (UIElement elem in lowest.elements)
123+
if (member.Parts.Length >= 2)
124+
foreach (string section in member.Parts[1..^1])
128125
{
129-
if (elem is not UIElement<UIGroup> group || elem.name != section)
130-
continue;
126+
bool found = false;
127+
128+
foreach (UIElement elem in lowest.elements)
129+
{
130+
if (elem is not UIElement<UIGroup> group || elem.name != section)
131+
continue;
132+
133+
lowest = group.Bound._value;
134+
found = true;
135+
break;
136+
}
137+
138+
if (found) continue;
131139

132-
lowest = group.Bound._value;
133-
found = true;
134-
break;
140+
Plugin.Logger.LogDebug("Creating new section: " + section);
141+
lowest = new(section, lowest);
135142
}
136143

137-
if (found) continue;
138-
139-
Plugin.Logger.LogDebug("Creating new section: " + section);
140-
lowest = new(section, lowest);
141-
}
142-
143144
lowest.AddElement(element);
144145
}
145146

0 commit comments

Comments
 (0)