Don't warp the mouse when a video mode hasn't been set
authorSam Lantinga <slouken@libsdl.org>
Fri, 07 Feb 2003 05:47:15 +0000
changeset 595 591b438ab94a
parent 594 a71ce390adeb
child 596 475f969e8c01
Don't warp the mouse when a video mode hasn't been set
src/video/SDL_cursor.c
--- 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;