From cf827f2167d7ca122541cc17307e2b8133ec3af4 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 9 Mar 2016 23:16:29 +0100 Subject: [PATCH] Ported Qt 4 fix when getting an invalid native key on Windows Task-number: QTBUG-36061 Change-Id: Ibde65735d861af4e1ef768e9e4314d30fed534a1 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5790341dbf..403ac6ecfb 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1247,7 +1247,12 @@ QList QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const { QList result; - const KeyboardLayoutItem &kbItem = keyLayout[e->nativeVirtualKey()]; + + const quint32 nativeVirtualKey = e->nativeVirtualKey(); + if (nativeVirtualKey > 255) + return result; + + const KeyboardLayoutItem &kbItem = keyLayout[nativeVirtualKey]; if (!kbItem.exists) return result;