From 890d03373588b611a1f5415f8ee4d4396e6aca7e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 18 Jul 2001 20:08:18 +0000 Subject: [PATCH] Fixed crash if mouse is outside of the screen bounds for some reason --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40114 --- src/video/SDL_cursor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_cursor.c b/src/video/SDL_cursor.c index a00b7232..7fe6bf6e 100644 --- a/src/video/SDL_cursor.c +++ b/src/video/SDL_cursor.c @@ -348,11 +348,11 @@ void SDL_MouseRect(SDL_Rect *area) } 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; } }