diff --git a/v2rayN/ServiceLib/Manager/GroupProfileManager.cs b/v2rayN/ServiceLib/Manager/GroupProfileManager.cs index 3c9d766e..4296059d 100644 --- a/v2rayN/ServiceLib/Manager/GroupProfileManager.cs +++ b/v2rayN/ServiceLib/Manager/GroupProfileManager.cs @@ -12,7 +12,7 @@ public class GroupProfileManager return await HasCycle(indexId, extraInfo, new HashSet(), new HashSet()); } - public static async Task HasCycle(string? indexId, ProtocolExtraItem? extraInfo, HashSet visited, HashSet stack) + private static async Task HasCycle(string? indexId, ProtocolExtraItem? extraInfo, HashSet visited, HashSet stack) { if (indexId.IsNullOrEmpty() || extraInfo == null) { @@ -75,20 +75,21 @@ public class GroupProfileManager return (await GetChildProfileItemsByProtocolExtra(protocolExtra), protocolExtra); } - public static async Task> GetChildProfileItemsByProtocolExtra(ProtocolExtraItem? protocolExtra) + private static async Task> GetChildProfileItemsByProtocolExtra(ProtocolExtraItem? protocolExtra) { if (protocolExtra == null) { return new(); } - var items = await GetSelectedChildProfileItems(protocolExtra); - var subItems = await GetSubChildProfileItems(protocolExtra); - items.AddRange(subItems); + + var items = new List(); + items.AddRange(await GetSubChildProfileItems(protocolExtra)); + items.AddRange(await GetSelectedChildProfileItems(protocolExtra)); return items; } - public static async Task> GetSelectedChildProfileItems(ProtocolExtraItem? extra) + private static async Task> GetSelectedChildProfileItems(ProtocolExtraItem? extra) { if (extra == null || extra.ChildItems.IsNullOrEmpty()) { @@ -105,10 +106,10 @@ public class GroupProfileManager p.ConfigType != EConfigType.Custom ) .ToList(); - return childProfiles; + return childProfiles ?? new(); } - public static async Task> GetSubChildProfileItems(ProtocolExtraItem? extra) + private static async Task> GetSubChildProfileItems(ProtocolExtraItem? extra) { if (extra == null || extra.SubChildItems.IsNullOrEmpty()) {