Return if AssociatedObject is null (shouldn't happen)
MODIFY
WalletWasabi.Fluent/Behaviors/TextBoxAutoSelectTextBehavior.cs
WalletWasabi.Fluent/Behaviors/TextBoxAutoSelectTextBehavior.cs
@@ -8,12 +8,17 @@ internal class TextBoxAutoSelectTextBehavior : AttachedToVisualTreeBehavior<Text
{
protected override void OnAttachedToVisualTree(CompositeDisposable disposable)
{
- AssociatedObject?.SelectAll();
- Observable.FromEventPattern(AssociatedObject!, "GotFocus")
- .Subscribe(_ => AssociatedObject!.SelectAll())
+ if (AssociatedObject is null)
+ {
+ return;
+ }
+
+ AssociatedObject.SelectAll();
+ Observable.FromEventPattern(AssociatedObject, "GotFocus")
+ .Subscribe(_ => AssociatedObject.SelectAll())
.DisposeWith(disposable);
- Observable.FromEventPattern(AssociatedObject!, "PointerReleased")
- .Subscribe(_ => AssociatedObject!.SelectAll())
+ Observable.FromEventPattern(AssociatedObject, "PointerReleased")
+ .Subscribe(_ => AssociatedObject.SelectAll())
.DisposeWith(disposable);;
}
}
\ No newline at end of file

Return if AssociatedObject is null (shouldn't happen)