Fixed crash if mouse is outside of the screen bounds for some reason
authorSam Lantinga <slouken@lokigames.com>
Wed, 18 Jul 2001 20:08:18 +0000
changeset 113e21ac1dd30f1
parent 112 9ef74357a5fb
child 114 dabc453ce7f7
Fixed crash if mouse is outside of the screen bounds for some reason
src/video/SDL_cursor.c
     1.1 --- a/src/video/SDL_cursor.c	Wed Jul 18 20:04:23 2001 +0000
     1.2 +++ b/src/video/SDL_cursor.c	Wed Jul 18 20:08:18 2001 +0000
     1.3 @@ -348,11 +348,11 @@
     1.4  	}
     1.5  	clip_diff = (area->x+area->w)-SDL_VideoSurface->w;
     1.6  	if ( clip_diff > 0 ) {
     1.7 -		area->w -= clip_diff;
     1.8 +		area->w = area->w < clip_diff ? 0 : area->w-clip_diff;
     1.9  	}
    1.10  	clip_diff = (area->y+area->h)-SDL_VideoSurface->h;
    1.11  	if ( clip_diff > 0 ) {
    1.12 -		area->h -= clip_diff;
    1.13 +		area->h = area->h < clip_diff ? 0 : area->h-clip_diff;
    1.14  	}
    1.15  }
    1.16