浏览代码

Merge pull request #4874 from YohDeadfall/key-gesture-matching

Fixed key gesture matching when this has an OEM key
Jumar Macato 5 年之前
父节点
当前提交
c75b8cef85
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/Avalonia.Input/KeyGesture.cs

+ 4 - 1
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)