mirror of
https://github.com/yawut/SDL.git
synced 2026-08-21 16:24:37 -05:00
Don't warp the mouse when a video mode hasn't been set
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user