diff --git a/src/UniGetUI.Avalonia/Models/PackageCollections.cs b/src/UniGetUI.Avalonia/Models/PackageCollections.cs index 66e18c265..21b45e931 100644 --- a/src/UniGetUI.Avalonia/Models/PackageCollections.cs +++ b/src/UniGetUI.Avalonia/Models/PackageCollections.cs @@ -327,8 +327,8 @@ public IEnumerable ApplyToList(IEnumerable items Sorter.Checked => w.IsChecked ? "0" : "1", Sorter.Name => w.Package.Name, Sorter.Id => w.Package.Id, - Sorter.Version => w.Package.NormalizedVersion.ToString(), - Sorter.NewVersion => w.Package.NormalizedNewVersion.ToString(), + Sorter.Version => w.Package.NormalizedVersion.ToString() ?? string.Empty, + Sorter.NewVersion => w.Package.NormalizedNewVersion.ToString() ?? string.Empty, Sorter.Source => w.Package.Source.AsString_DisplayName, _ => w.Package.Name, }; diff --git a/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxButtonCard.cs b/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxButtonCard.cs index 17055912a..7cd29d8e6 100644 --- a/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxButtonCard.cs +++ b/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxButtonCard.cs @@ -94,7 +94,10 @@ public CheckboxButtonCard() StateChanged?.Invoke(this, EventArgs.Empty); Button.IsEnabled = (_checkbox.IsChecked ?? false) ? true : _buttonAlwaysOn; _textblock.Opacity = (_checkbox.IsChecked ?? false) ? 1 : 0.7; - AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + if (_textblock.Text is not null) + { + AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + } }; Button.Click += (s, e) => Click?.Invoke(s, e); ApplyAutomationMetadata(_checkbox, _textblock.Text); diff --git a/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxCard.cs b/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxCard.cs index 45b5d1fe4..a1e24c950 100644 --- a/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxCard.cs +++ b/src/UniGetUI.Avalonia/Views/Controls/Settings/CheckboxCard.cs @@ -118,7 +118,10 @@ protected virtual void _checkbox_Toggled(object? sender, RoutedEventArgs e) StateChanged?.Invoke(this, EventArgs.Empty); _textblock.Opacity = (_checkbox.IsChecked ?? false) ? 1 : 0.7; SyncToggleItemStatus(); - AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + if (_textblock.Text is not null) + { + AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + } var cmd = StateChangedCommand; if (cmd?.CanExecute(null) == true) cmd.Execute(null); @@ -133,9 +136,11 @@ protected void SyncToggleItemStatus() AutomationProperties.SetItemStatus(_checkbox, state); // Name with state suffix: guarantees VoiceOver announces state on macOS // where ToggleSwitch AX role may not expose IsChecked natively - string baseName = _textblock.Text; + string? baseName = _textblock.Text; if (!string.IsNullOrEmpty(baseName)) + { AutomationProperties.SetName(_checkbox, $"{baseName}, {state}"); + } } } @@ -197,6 +202,9 @@ protected override void _checkbox_Toggled(object? sender, RoutedEventArgs e) StateChanged?.Invoke(this, EventArgs.Empty); _textblock.Opacity = (_checkbox.IsChecked ?? false) ? 1 : 0.7; SyncToggleItemStatus(); - AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + if (_textblock.Text is not null) + { + AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + } } } diff --git a/src/UniGetUI.Avalonia/Views/Controls/Settings/SecureCheckboxCard.cs b/src/UniGetUI.Avalonia/Views/Controls/Settings/SecureCheckboxCard.cs index 2e67cc7ba..7332c4432 100644 --- a/src/UniGetUI.Avalonia/Views/Controls/Settings/SecureCheckboxCard.cs +++ b/src/UniGetUI.Avalonia/Views/Controls/Settings/SecureCheckboxCard.cs @@ -150,7 +150,10 @@ await SecureSettings.TrySet( cmd.Execute(null); _textblock.Opacity = (_checkbox.IsChecked ?? false) ? 1 : 0.7; _checkbox.IsChecked = SecureSettings.Get(setting_name) ^ IS_INVERTED ^ ForceInversion; - AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + if (_textblock.Text is not null) + { + AccessibilityAnnouncementService.AnnounceToggle(_textblock.Text, _checkbox.IsChecked ?? false); + } _loading.IsVisible = false; _checkbox.IsEnabled = true; }