Don't warp the mouse when a video mode hasn't been set
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40596
This commit is contained in:
parent
582b9152ff
commit
b1b661bc3f
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue