Skip to content

Commit

Permalink
Fix system profile crash if subgroup has no tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
olehkuznetsov committed Oct 22, 2024
1 parent eb52b61 commit 990afe0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ public Builder() {
public Builder addGroup(String parent, String id, String name, Group.UiFactory ui) {
groups.computeIfAbsent(parent, $ -> Lists.newArrayList())
.add(newElement(id, name, false, ui));
groups.computeIfAbsent(id, $ -> Lists.newArrayList());
return this;
}

public Builder addLabelGroup(String parent, String id, String name, Group.UiFactory ui) {
groups.computeIfAbsent(parent, $ -> Lists.newArrayList())
.add(newElement(id, name, true, ui));
groups.computeIfAbsent(id, $ -> Lists.newArrayList());
return this;
}

Expand Down Expand Up @@ -143,7 +145,9 @@ private Group buildGroup(String id) {
ImmutableList.Builder<Element<?>> children = ImmutableList.builder();
for (ElementBuilder child : groups.get(id)) {
if (groups.containsKey(child.id)) {
children.add(buildGroup(child.id));
if(!groups.get(child.id).isEmpty()) {
children.add(buildGroup(child.id));
}
} else {
children.add(child.track());
}
Expand Down

0 comments on commit 990afe0

Please sign in to comment.