wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Fix: possible NullReferenceException in PasswordBox

Open textGamex opened this issue 1 year ago • 0 comments

Pull request type

Please check the type of change your PR introduces:

  • [ ] Update
  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes

What is the current behavior?

In the current version v3.0.4, binding the Password property of the PasswordBox control to a null property results in a NullReferenceException being thrown

<ui:PasswordBox Password="{Binding Password}" />
public partial class MainWindow : Window
{
    public MainWindowsViewModel Context { get; set; }
    public MainWindow()
    {
        Context = new MainWindowsViewModel();
        DataContext = Context;
        InitializeComponent();
    }
}

public partial class MainWindowsViewModel : ObservableObject
{
    [ObservableProperty]
    private string? _password = null;
}

screenshot screenshot

Issue Number: N/A

What is the new behavior?

  • Fix this bug.

Other information

textGamex avatar May 18 '24 17:05 textGamex