Skip to content

Commit

Permalink
Don't warp the mouse when a video mode hasn't been set
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 7, 2003
1 parent 2cd27b5 commit 6bfc19e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/SDL_cursor.c
Expand Up @@ -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;
Expand Down

0 comments on commit 6bfc19e

Please sign in to comment.