X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/004867dbc54950a43acc7d250fa4a966f046a679..30a7e91fb03558a4ffb6c5c6206ea25e53905e22:/src/unix/joystick.cpp diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index f9f2ba9d41..cf9cc33b3e 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -4,7 +4,6 @@ // Author: Ported to Linux by Guilhem Lavaux // Modified by: // Created: 05/23/98 -// RCS-ID: $Id$ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,6 +18,7 @@ #ifndef WX_PRECOMP #include "wx/event.h" #include "wx/window.h" + #include "wx/log.h" #endif //WX_PRECOMP #include "wx/thread.h" @@ -136,6 +136,14 @@ void* wxJoystickThread::Entry() if ((j_evt.type & JS_EVENT_AXIS) && (j_evt.number < wxJS_MAX_AXES)) { + // Ignore invalid axis. + if ( j_evt.number >= wxJS_MAX_AXES ) + { + wxLogDebug(wxS("Invalid axis index %d in joystick message."), + j_evt.number); + continue; + } + if ( (m_axe[j_evt.number] + m_threshold < j_evt.value) || (m_axe[j_evt.number] - m_threshold > j_evt.value) ) {