nullable reference type fixes.
MODIFY
WalletWasabi.Fluent/ViewModels/RecoverWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/RecoverWalletPageViewModel.cs
@@ -14,18 +14,18 @@ namespace WalletWasabi.Fluent.ViewModels
public class RecoveryPageViewModel : NavBarItemViewModel
{
private readonly ObservableAsPropertyHelper<Mnemonic?> _currentMnemonic;
- private IEnumerable<string> _suggestions;
- private string _selectedTag;
+ private IEnumerable<string>? _suggestions;
+ private string? _selectedTag;
public ObservableCollection<string> Mnemonics { get; } = new ObservableCollection<string>();
- public IEnumerable<string> Suggestions
+ public IEnumerable<string>? Suggestions
{
get => _suggestions;
set => this.RaiseAndSetIfChanged(ref _suggestions, value);
}
- public string SelectedTag
+ public string? SelectedTag
{
get => _selectedTag;
set => this.RaiseAndSetIfChanged(ref _selectedTag, value);
@@ -43,7 +43,6 @@ namespace WalletWasabi.Fluent.ViewModels
.Where(x => !string.IsNullOrEmpty(x))
.Subscribe(AddMnemonic);
- // TODO: Will try to find ways of doing this better...
this.WhenAnyValue(x => x.CurrentMnemonics)
.Subscribe(x => this.RaisePropertyChanged(nameof(Mnemonics)));
@@ -58,9 +57,13 @@ namespace WalletWasabi.Fluent.ViewModels
}
}
- private void AddMnemonic(string tagString)
+ private void AddMnemonic(string? tagString)
+ {
+ if (!string.IsNullOrWhiteSpace(tagString))
{
Mnemonics.Add(tagString);
+ }
+
SelectedTag = string.Empty;
}
@@ -69,7 +72,7 @@ namespace WalletWasabi.Fluent.ViewModels
return string.Join(' ', Mnemonics);
}
- public Mnemonic? CurrentMnemonics => _currentMnemonic.Value;
+ private Mnemonic? CurrentMnemonics => _currentMnemonic.Value;
public override string IconName => "settings_regular";
}

nullable reference type fixes.