]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/joystick.cpp
Disable wxUSE_ENH_METAFILE for wxGTK builds.
[wxWidgets.git] / src / unix / joystick.cpp
index f9f2ba9d41dd2cafc77c695d0da5ed79d4816c7f..27b3b6cb74a8d67e254cc800c00ac3bc9c3134be 100644 (file)
@@ -19,6 +19,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 +137,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) )
             {