From f97792f2ca6249f6d7131fd11ff6cf0e860e52ce Mon Sep 17 00:00:00 2001 From: Carti Date: Tue, 3 Feb 2026 08:10:32 +0100 Subject: [PATCH] Throw useful exception when handler is null --- src/Avalonia.X11/Dispatching/X11EventDispatcher.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Avalonia.X11/Dispatching/X11EventDispatcher.cs b/src/Avalonia.X11/Dispatching/X11EventDispatcher.cs index 36625a61cd..59560e4ecb 100644 --- a/src/Avalonia.X11/Dispatching/X11EventDispatcher.cs +++ b/src/Avalonia.X11/Dispatching/X11EventDispatcher.cs @@ -47,7 +47,12 @@ internal class X11EventDispatcher } } else if (_eventHandlers.TryGetValue(xev.AnyEvent.window, out var handler)) + { + if (handler is null) + throw new NullReferenceException($"Event handler for event '{xev.AnyEvent}' and window '{xev.AnyEvent.window}' is null"); + handler(ref xev); + } } finally {