changeset 113:e21ac1dd30f1

Fixed crash if mouse is outside of the screen bounds for some reason
author Sam Lantinga <slouken@lokigames.com>
date Wed, 18 Jul 2001 20:08:18 +0000
parents 9ef74357a5fb
children dabc453ce7f7
files src/video/SDL_cursor.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
 }