minor joystick corrections

This commit is contained in:
dborth 2009-06-30 06:14:45 +00:00
parent 1268f79f9e
commit 6478c23656

View file

@ -190,7 +190,7 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
return(-1);
}
SDL_memset(joystick->hwdata, 0, sizeof(joystick_hwdata));
if((joystick->index < 4) && (__jspad_enabled))
if((joystick->index < 4) && (__jswpad_enabled))
{
if(joystick->index < __numwiijoysticks)
{
@ -477,8 +477,9 @@ static void _HandleGCJoystickUpdate(SDL_Joystick* joystick)
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
if(!joystick)
if(!joystick || !joystick->hwdata)
return;
switch(((joystick_hwdata*)(joystick->hwdata))->type)
{
case 0:
@ -497,7 +498,9 @@ void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
if (joystick->hwdata != NULL)
if(!joystick || !joystick->hwdata) // joystick already closed
return;
SDL_free(joystick->hwdata);
/* Clear callback again */