Skip to content

Commit fe18379

Browse files
committed
Refactor child item aggregation in managers
1 parent 947c84c commit fe18379

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ private async Task<List<string>> ValidateGroupNode(ProfileItem item, ECoreType?
214214
return errors;
215215
}
216216

217-
var childIds = Utils.String2List(group.ChildItems) ?? [];
217+
var childIds = new List<string>();
218218
var subItems = await ProfileGroupItemManager.GetSubChildProfileItems(group);
219219
childIds.AddRange(subItems.Select(p => p.IndexId));
220+
childIds.AddRange(Utils.String2List(group.ChildItems));
220221

221222
foreach (var child in childIds)
222223
{

v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,10 @@ public static bool HasCycle(string? indexId, HashSet<string> visited, HashSet<st
230230
{
231231
return (new List<ProfileItem>(), profileGroupItem);
232232
}
233-
var items = await GetChildProfileItems(profileGroupItem);
234-
var subItems = await GetSubChildProfileItems(profileGroupItem);
235-
items.AddRange(subItems);
233+
234+
var items = new List<ProfileItem>();
235+
items.AddRange(await GetSubChildProfileItems(profileGroupItem));
236+
items.AddRange(await GetChildProfileItems(profileGroupItem));
236237

237238
return (items, profileGroupItem);
238239
}

0 commit comments

Comments
 (0)