From ff10b54405fe8980a022e98cd79d912c1f0ac353 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Feb 2016 02:12:14 +0300 Subject: Add missing checks. --- src/input/keyboardconfig.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/input/keyboardconfig.cpp') 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); -- cgit v1.2.3-60-g2f50