diff --git a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs index 2449f4c15c..630276767a 100644 --- a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs +++ b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs @@ -102,15 +102,12 @@ namespace Avalonia.Controls.Notifications Content = content }; - if (notification != null) + notificationControl.NotificationClosed += (sender, args) => { - notificationControl.NotificationClosed += (sender, args) => - { - notification.OnClose?.Invoke(); + notification?.OnClose?.Invoke(); - _items?.Remove(sender); - }; - } + _items?.Remove(sender); + }; notificationControl.PointerPressed += (sender, args) => {