From 8ccbd6783ef69f8419e4e1f3ecb8cf74035a7f91 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 9 Jan 2026 10:40:59 +0000 Subject: [PATCH] Fix null reference error when filtering providers by language pairs When routing is disabled and a provider is selected, the ProviderSupportsPair method was calling .Any() on potentially null Pairs and Symmetric arrays, causing 'Value can't be null. Parameter source' error. Added null checks before calling LINQ methods on provider.Pairs and provider.Symmetric arrays. Co-Authored-By: Vladimir Popinov --- Intento.MT.Plugin.PropertiesForm/States/ProviderState.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Intento.MT.Plugin.PropertiesForm/States/ProviderState.cs b/Intento.MT.Plugin.PropertiesForm/States/ProviderState.cs index b919c4d..b76c3df 100644 --- a/Intento.MT.Plugin.PropertiesForm/States/ProviderState.cs +++ b/Intento.MT.Plugin.PropertiesForm/States/ProviderState.cs @@ -258,12 +258,13 @@ public AuthState GetAuthState() private static bool ProviderSupportsPair(Provider provider, LangPair pair) { - if (provider.Pairs.Any(p => p.From == pair.From && p.To == pair.To)) + if (provider.Pairs != null && provider.Pairs.Any(p => p.From == pair.From && p.To == pair.To)) { return true; } - return provider.Symmetric.Any(x => x == pair.From) && + return provider.Symmetric != null && + provider.Symmetric.Any(x => x == pair.From) && provider.Symmetric.Any(x => x == pair.To); } @@ -440,4 +441,4 @@ public void SetLanguageComboBoxes(string from, string to) #endregion methods for managing a group of controls } -} \ No newline at end of file +}