changeset 595:591b438ab94a

Don't warp the mouse when a video mode hasn't been set
author Sam Lantinga <slouken@libsdl.org>
date Fri, 07 Feb 2003 05:47:15 +0000
parents a71ce390adeb
children 475f969e8c01
files src/video/SDL_cursor.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_cursor.c	Tue Feb 04 21:05:20 2003 +0000
+++ b/src/video/SDL_cursor.c	Fri Feb 07 05:47:15 2003 +0000
@@ -295,6 +295,11 @@
 	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;