From fdd9b1f31ff3c9ea3e70030c3c231983bcf0d765 Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Thu, 15 Oct 2020 22:01:11 +0300 Subject: [PATCH] Fixed key gesture matching when this has an OEM key --- src/Avalonia.Input/KeyGesture.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Input/KeyGesture.cs b/src/Avalonia.Input/KeyGesture.cs index aa6fcc8bff..e155666631 100644 --- a/src/Avalonia.Input/KeyGesture.cs +++ b/src/Avalonia.Input/KeyGesture.cs @@ -144,7 +144,10 @@ namespace Avalonia.Input return s.ToString(); } - public bool Matches(KeyEventArgs keyEvent) => ResolveNumPadOperationKey(keyEvent.Key) == Key && keyEvent.KeyModifiers == KeyModifiers; + public bool Matches(KeyEventArgs keyEvent) => + keyEvent != null && + keyEvent.KeyModifiers == KeyModifiers && + ResolveNumPadOperationKey(keyEvent.Key) == ResolveNumPadOperationKey(Key); // TODO: Move that to external key parser private static Key ParseKey(string key)