From 3aeb6a4385c557edd7d4d915a2d38dccdde62d72 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Mon, 29 Apr 2024 09:36:51 -0700 Subject: [PATCH] Mac: Fix NRE when handling TextInput In some cases Window can be null when calling FirstRectForCharacterRange --- src/Eto.Mac/Forms/MacViewTextInput.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Eto.Mac/Forms/MacViewTextInput.cs b/src/Eto.Mac/Forms/MacViewTextInput.cs index 16f3cd23d1..d2b24b6679 100644 --- a/src/Eto.Mac/Forms/MacViewTextInput.cs +++ b/src/Eto.Mac/Forms/MacViewTextInput.cs @@ -48,7 +48,7 @@ static CGRect FirstRectForCharacterRange(IntPtr sender, IntPtr sel, NSRange rang if (obj is NSView ctl && MacBase.GetHandler(obj) is IMacViewHandler handler) { var rect = ctl.ConvertRectToView(ctl.Bounds, null); - return ctl.Window.ConvertRectToScreen(rect); + return ctl.Window?.ConvertRectToScreen(rect) ?? CGRect.Empty; } return CGRect.Empty; }