summaryrefslogtreecommitdiff
path: root/src/inputmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-11 03:40:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-11 03:40:16 +0300
commitdc53f8b7f360a489bd10355131339809d66378ef (patch)
treed97daa27aefe91866e8b64864c58236291f38b14 /src/inputmanager.cpp
parentc810ee1fe7b42202a66935575a88264911f2c625 (diff)
downloadmv-dc53f8b7f360a489bd10355131339809d66378ef.tar.gz
mv-dc53f8b7f360a489bd10355131339809d66378ef.tar.bz2
mv-dc53f8b7f360a489bd10355131339809d66378ef.tar.xz
mv-dc53f8b7f360a489bd10355131339809d66378ef.zip
Add joystick validation before triggering events from it.
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r--src/inputmanager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index 8a9e89995..e7ac40cf0 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -489,8 +489,11 @@ bool InputManager::handleEvent(const SDL_Event &event)
break;
case SDL_JOYBUTTONDOWN:
- if (triggerAction(joystick->getActionVector(event)))
- return true;
+ if (joystick && joystick->validate())
+ {
+ if (triggerAction(joystick->getActionVector(event)))
+ return true;
+ }
break;
default:
break;