From 023f9f1a7ee6485eb4613d265aaa04cfe1be418c Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sat, 28 Feb 2026 19:27:00 +0800 Subject: [PATCH] Fix --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 19 ++++++++++++++----- .../ServiceLib/Manager/GroupProfileManager.cs | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index a08ef708..42f0042e 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1191,10 +1191,15 @@ public static class ConfigHandler { var result = new RetResult(); - var indexId = Utils.GetGuid(false); var subId = subItem?.Id; + if (subId.IsNullOrEmpty()) + { + result.Success = false; + return result; + } - var remark = subItem is null ? ResUI.TbConfigTypePolicyGroup : $"{subItem.Remarks} - {ResUI.TbConfigTypePolicyGroup}"; + var indexId = Utils.GetGuid(false); + var remark = $"{subItem.Remarks} - {ResUI.TbConfigTypePolicyGroup}"; var profile = new ProfileItem { IndexId = indexId, @@ -1245,14 +1250,18 @@ public static class ConfigHandler public static async Task AddGroupRegionServer(Config config, SubItem? subItem) { var result = new RetResult(); + var subId = subItem?.Id; + if (subId.IsNullOrEmpty()) + { + result.Success = false; + return result; + } List indexIdList = []; foreach (var regionFilter in PolicyGroupRegionFilters) { var indexId = Utils.GetGuid(false); - var subId = subItem?.Id; - - var remark = subItem is null ? ResUI.TbConfigTypePolicyGroup : $"{subItem.Remarks} - {ResUI.TbConfigTypePolicyGroup} - {regionFilter.Key}"; + var remark = $"{subItem.Remarks} - {ResUI.TbConfigTypePolicyGroup} - {regionFilter.Key}"; var profile = new ProfileItem { IndexId = indexId, diff --git a/v2rayN/ServiceLib/Manager/GroupProfileManager.cs b/v2rayN/ServiceLib/Manager/GroupProfileManager.cs index 027cf193..510667dd 100644 --- a/v2rayN/ServiceLib/Manager/GroupProfileManager.cs +++ b/v2rayN/ServiceLib/Manager/GroupProfileManager.cs @@ -128,7 +128,7 @@ public class GroupProfileManager private static async Task> GetSubChildProfileItems(ProtocolExtraItem? extra) { - if (extra == null || extra.Filter.IsNullOrEmpty()) + if (extra == null || extra.SubChildItems.IsNullOrEmpty()) { return []; }