diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index e699a78e..d76e26e0 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -165,7 +165,7 @@ namespace ServiceLib.ViewModels { return; } - foreach (var it in SelectedSources) + foreach (var it in SelectedSources ?? [SelectedSource]) { var item = _rules.FirstOrDefault(t => t.id == it?.id); if (item != null) @@ -186,7 +186,7 @@ namespace ServiceLib.ViewModels } var lst = new List(); - foreach (var it in SelectedSources) + foreach (var it in SelectedSources ?? [SelectedSource]) { var item = _rules.FirstOrDefault(t => t.id == it?.id); if (item != null) diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index 8ce7d3a5..bf059948 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -256,7 +256,7 @@ namespace ServiceLib.ViewModels { return; } - foreach (var it in SelectedSources) + foreach (var it in SelectedSources ?? [SelectedSource]) { var item = LazyConfig.Instance.GetRoutingItem(it?.id); if (item != null) diff --git a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs index 4d7592cb..36f63874 100644 --- a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs @@ -90,7 +90,7 @@ namespace ServiceLib.ViewModels return; } - foreach (var it in SelectedSources) + foreach (var it in SelectedSources ?? [SelectedSource]) { ConfigHandler.DeleteSubItem(_config, it.id); }