From 2470dc5f440e236325bfa03d6bdbca06b567b9ec Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 15 Oct 2015 23:07:05 +0200 Subject: [PATCH] Allow for no hits when hit testing. This can happen e.g. if mouse is captured and moves out of bounds of window. Fixes #265. --- src/Perspex.Input/InputExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Perspex.Input/InputExtensions.cs b/src/Perspex.Input/InputExtensions.cs index 50d826b2a9..705d9d7b14 100644 --- a/src/Perspex.Input/InputExtensions.cs +++ b/src/Perspex.Input/InputExtensions.cs @@ -54,7 +54,7 @@ namespace Perspex.Input /// The topmost at the specified position. public static IInputElement InputHitTest(this IInputElement element, Point p) { - return element.GetInputElementsAt(p).First(); + return element.GetInputElementsAt(p).FirstOrDefault(); } private static IEnumerable ZSort(IEnumerable elements)