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 595591b438ab94a
parent 594 a71ce390adeb
child 596 475f969e8c01
Don't warp the mouse when a video mode hasn't been set
src/video/SDL_cursor.c
     1.1 --- a/src/video/SDL_cursor.c	Tue Feb 04 21:05:20 2003 +0000
     1.2 +++ b/src/video/SDL_cursor.c	Fri Feb 07 05:47:15 2003 +0000
     1.3 @@ -295,6 +295,11 @@
     1.4  	SDL_VideoDevice *video = current_video;
     1.5  	SDL_VideoDevice *this  = current_video;
     1.6  
     1.7 +	if ( !video || !SDL_PublicSurface ) {
     1.8 +		SDL_SetError("A video mode must be set before warping mouse");
     1.9 +		return;
    1.10 +	}
    1.11 +
    1.12  	/* If we have an offset video mode, offset the mouse coordinates */
    1.13  	x += (this->screen->offset % this->screen->pitch) /
    1.14  	      this->screen->format->BytesPerPixel;