diff src/video/SDL_cursor.c @ 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 1e7e61b9b0f9
children e8157fcb3114
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;
 	}
 }