diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 72b50c01..8841a69e 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -3536,12 +3536,15 @@ void Graphics::get_stretch_info(SDL_Rect* rect) break; default: SDL_assert(0 && "Invalid scaling mode!"); - /* Width and height should be nonzero to avoid division by zero. */ rect->x = 0; rect->y = 0; rect->w = width; rect->h = height; } + + // In case anything accidentally set the width/height to 0, we'll clamp it to avoid crashing from a division by 0 + rect->w = SDL_max(1, rect->w); + rect->h = SDL_max(1, rect->h); } void Graphics::render(void)