diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index 95900f72a04..8e9c92864c7 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -1103,7 +1103,9 @@ public void Activate() else { XRaiseWindow(_x11.Display, _handle); - XSetInputFocus(_x11.Display, _focusProxy._handle, 0, IntPtr.Zero); + + if (_focusProxy is not null) + XSetInputFocus(_x11.Display, _focusProxy._handle, 0, IntPtr.Zero); } }