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 113 e21ac1dd30f1
parent 112 9ef74357a5fb
child 114 dabc453ce7f7
Fixed crash if mouse is outside of the screen bounds for some reason
src/video/SDL_cursor.c
--- a/src/video/SDL_cursor.c	Wed Jul 18 20:04:23 2001 +0000
+++ b/src/video/SDL_cursor.c	Wed Jul 18 20:08:18 2001 +0000
@@ -348,11 +348,11 @@
 	}
 	clip_diff = (area->x+area->w)-SDL_VideoSurface->w;
 	if ( clip_diff > 0 ) {
-		area->w -= clip_diff;
+		area->w = area->w < clip_diff ? 0 : area->w-clip_diff;
 	}
 	clip_diff = (area->y+area->h)-SDL_VideoSurface->h;
 	if ( clip_diff > 0 ) {
-		area->h -= clip_diff;
+		area->h = area->h < clip_diff ? 0 : area->h-clip_diff;
 	}
 }