From cf4dd968717f46504e2754675dba11ee38b72b57 Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 8 Dec 2012 22:35:27 +0000 Subject: [PATCH] Fix memory overflow git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12215 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/input/input_device.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/input/input_device.cpp b/src/input/input_device.cpp index 2d694e4b9..3f5e444fe 100644 --- a/src/input/input_device.cpp +++ b/src/input/input_device.cpp @@ -173,10 +173,9 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id, if (type == Input::IT_STICKMOTION) { - if (id >= m_axis_count && id != Input::HAT_H_ID && - id != Input::HAT_V_ID) - return false; // this gamepad doesn't even have that many axes - + // this gamepad doesn't even have that many axes + if (id >= m_axis_count) return false; + if (player != NULL) { // going to negative from positive @@ -193,7 +192,7 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id, resetAxisDirection(id, Input::AD_NEGATIVE, player); } } - + if (value > 0) m_prevAxisDirections[id] = Input::AD_POSITIVE; else if(value < 0) m_prevAxisDirections[id] = Input::AD_NEGATIVE;