src/video/windx5/SDL_dx5events.c
branchSDL-1.2
changeset 4383 daf9e6037596
parent 4291 6cc2b35ac610
child 4384 6800e2560310
     1.1 --- a/src/video/windx5/SDL_dx5events.c	Mon Nov 09 18:02:32 2009 +0000
     1.2 +++ b/src/video/windx5/SDL_dx5events.c	Sun Nov 15 17:21:24 2009 +0000
     1.3 @@ -559,13 +559,15 @@
     1.4  
     1.5  			active = (wParam && (GetForegroundWindow() == hwnd));
     1.6  			if ( active ) {
     1.7 -				for ( i=0; SDL_DIdev[i]; ++i ) {
     1.8 -					IDirectInputDevice2_Acquire(
     1.9 +				for ( i=0; i<MAX_INPUTS; ++i ) {
    1.10 +					if (SDL_DIdev[i] != NULL)
    1.11 +						IDirectInputDevice2_Acquire(
    1.12  								SDL_DIdev[i]);
    1.13  				}
    1.14  			} else {
    1.15 -				for ( i=0; SDL_DIdev[i]; ++i ) {
    1.16 -					IDirectInputDevice2_Unacquire(
    1.17 +				for ( i=0; i<MAX_INPUTS; ++i ) {
    1.18 +					if (SDL_DIdev[i] != NULL) 
    1.19 +						IDirectInputDevice2_Unacquire(
    1.20  								SDL_DIdev[i]);
    1.21  				}
    1.22  				mouse_lost = 1;