From 6bfc19ed0325371dbacede07c77f57688cbd3825 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 7 Feb 2003 05:47:15 +0000 Subject: [PATCH] Don't warp the mouse when a video mode hasn't been set --- src/video/SDL_cursor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/SDL_cursor.c b/src/video/SDL_cursor.c index 3d19abade..7dc31d6ee 100644 --- a/src/video/SDL_cursor.c +++ b/src/video/SDL_cursor.c @@ -295,6 +295,11 @@ void SDL_WarpMouse (Uint16 x, Uint16 y) SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; + if ( !video || !SDL_PublicSurface ) { + SDL_SetError("A video mode must be set before warping mouse"); + return; + } + /* If we have an offset video mode, offset the mouse coordinates */ x += (this->screen->offset % this->screen->pitch) / this->screen->format->BytesPerPixel;