From 53ee410d7a755287764173b4d89df8c90aa32f8c Mon Sep 17 00:00:00 2001
From: Marcin Serwin <[EMAIL REDACTED]>
Date: Sun, 9 Nov 2025 11:21:41 +0100
Subject: [PATCH] Don't divide by zero in slow blitter
Other blitters seem to handle zero width/height destinations correctly.
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
---
src/video/SDL_blit_slow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c
index d9b01f01d9daa..63f08f2ddc41b 100644
--- a/src/video/SDL_blit_slow.c
+++ b/src/video/SDL_blit_slow.c
@@ -85,8 +85,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
last_index = SDL_LookupRGBAColor(palette_map, last_pixel, dst_pal);
}
- incy = ((Uint64)info->src_h << 16) / info->dst_h;
- incx = ((Uint64)info->src_w << 16) / info->dst_w;
+ incy = info->dst_h ? ((Uint64)info->src_h << 16) / info->dst_h : 0;
+ incx = info->dst_w ? ((Uint64)info->src_w << 16) / info->dst_w : 0;
posy = incy / 2; // start at the middle of pixel
while (info->dst_h--) {