summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-24 05:28:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-24 07:02:01 +0200
commit69eb5f7b8c712482bb960f49e5c9ec717a902858 (patch)
tree19daf8b2eeac61071af2f736d301890d1f5a50d7
parentff8e80816a8e0a67644c0cb62bbfa01a5eb94246 (diff)
check if keycode exists first, since keystate can be outta whack
-rw-r--r--opentrack/shortcuts.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index 6ccefef9..851c5826 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -94,7 +94,8 @@ static bool isKeyPressed( const Key *key, const BYTE *keystate ) {
bool ctrl;
bool alt;
- if (keystate[key->keycode] & 0x80) {
+ if (key->keycode != 0 && keystate[key->keycode] & 0x80)
+ {
shift = ( (keystate[DIK_LSHIFT] & 0x80) || (keystate[DIK_RSHIFT] & 0x80) );
ctrl = ( (keystate[DIK_LCONTROL] & 0x80) || (keystate[DIK_RCONTROL] & 0x80) );
alt = ( (keystate[DIK_LALT] & 0x80) || (keystate[DIK_RALT] & 0x80) );