# HG changeset patch # User Ryan C. Gordon # Date 1130651146 0 # Node ID 96ef834676676f41356350a4688d0b450dc81ce6 # Parent 2651158f59b8f80f2d2b03530cf940c7566217fc Prevent division-by-zero in WarpMouse if surface's pitch is zero (a GL surface?). diff -r 2651158f59b8 -r 96ef83467667 src/video/SDL_cursor.c --- a/src/video/SDL_cursor.c Thu Oct 20 06:55:26 2005 +0000 +++ b/src/video/SDL_cursor.c Sun Oct 30 05:45:46 2005 +0000 @@ -303,9 +303,14 @@ } /* If we have an offset video mode, offset the mouse coordinates */ - x += (this->screen->offset % this->screen->pitch) / - this->screen->format->BytesPerPixel; - y += (this->screen->offset / this->screen->pitch); + if (this->screen->pitch == 0) { + x += this->screen->offset / this->screen->format->BytesPerPixel; + y += this->screen->offset; + } else { + x += (this->screen->offset % this->screen->pitch) / + this->screen->format->BytesPerPixel; + y += (this->screen->offset / this->screen->pitch); + } /* This generates a mouse motion event */ if ( video->WarpWMCursor ) {