Skip to content
Browse files

Prevent of using uninitialized joystick variables in Application.cpp

  • Loading branch information...
1 parent e00733f commit 444ebb44c8681579a2f763b52fe6b8be1951c662 @Karlson2k committed Jul 6, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 xbmc/Application.cpp
View
7 xbmc/Application.cpp
@@ -2813,8 +2813,9 @@ bool CApplication::ProcessGamepad(float frameTime)
#ifdef HAS_SDL_JOYSTICK
if (!m_AppFocused)
return false;
+
int iWin = GetActiveWindowID();
- int bid;
+ int bid = 0;
g_Joystick.Update();
if (g_Joystick.GetButton(bid))
{
@@ -2873,7 +2874,7 @@ bool CApplication::ProcessGamepad(float frameTime)
g_Joystick.ResetAxis(abs(bid));
}
}
- int position;
+ int position = 0;
if (g_Joystick.GetHat(bid, position))
{
// reset Idle Timer
@@ -2892,7 +2893,7 @@ bool CApplication::ProcessGamepad(float frameTime)
bid = position<<16|bid;
- if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, g_Joystick.GetJoystick().c_str(), bid, JACTIVE_HAT, actionID, actionName, fullrange))
+ if (bid && CButtonTranslator::GetInstance().TranslateJoystickString(iWin, g_Joystick.GetJoystick().c_str(), bid, JACTIVE_HAT, actionID, actionName, fullrange))
{
CAction action(actionID, 1.0f, 0.0f, actionName);
g_audioManager.PlayActionSound(action);

0 comments on commit 444ebb4

Please sign in to comment.
Something went wrong with that request. Please try again.