diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-21 02:12:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-21 02:53:45 +0300 |
commit | ff10b54405fe8980a022e98cd79d912c1f0ac353 (patch) | |
tree | 679a8096d1e30858760196c2a2ef95ddd6bcd58c /src/input/keyboardconfig.cpp | |
parent | 6c01b391c288622d8e360d823c9c1e35a874fa58 (diff) | |
download | mv-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.gz mv-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.bz2 mv-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.xz mv-ff10b54405fe8980a022e98cd79d912c1f0ac353.zip |
Add missing checks.
Diffstat (limited to 'src/input/keyboardconfig.cpp')
-rw-r--r-- | src/input/keyboardconfig.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index 2c821807b..81b16ecf2 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -184,7 +184,7 @@ InputActionT KeyboardConfig::getActionId(const SDL_Event &event) bool KeyboardConfig::isActionActive(const InputActionT index) const { - if (!mActiveKeys) + if (!mActiveKeys || !mActiveKeys2) return false; const InputFunction &key = inputManager.getKey(index); @@ -217,6 +217,8 @@ void KeyboardConfig::update() void KeyboardConfig::handleActicateKey(const SDL_Event &event) { + if (!mActiveKeys2) + return; const int key = getKeyValueFromEvent(event); if (key < -1 && key > -500) mActiveKeys2[-key] = 1; @@ -225,6 +227,8 @@ void KeyboardConfig::handleActicateKey(const SDL_Event &event) void KeyboardConfig::handleActicateKey(const int key) { + if (!mActiveKeys2) + return; if (key < -1 && key > -500) mActiveKeys2[-key] = 1; resetRepeat(key); @@ -232,6 +236,8 @@ void KeyboardConfig::handleActicateKey(const int key) void KeyboardConfig::handleDeActicateKey(const SDL_Event &event) { + if (!mActiveKeys2) + return; const int key = getKeyValueFromEvent(event); if (key < -1 && key > -500) mActiveKeys2[-key] = 0; @@ -240,6 +246,8 @@ void KeyboardConfig::handleDeActicateKey(const SDL_Event &event) void KeyboardConfig::handleDeActicateKey(const int key) { + if (!mActiveKeys2) + return; if (key < -1 && key > -500) mActiveKeys2[-key] = 0; resetRepeat(key); |