From 2762644e96172b1a743d29be2c94b8fd35e1f957 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 2 Dec 2024 09:47:25 -0500 Subject: [PATCH] video: Don't error when setting an unbounded max window size while a minimum is set If the maximum size was changed to 0 (unbounded) while a minimum was set, the sanity check ensuring that the max size isn't less than the minimum size would incorrectly cause the operation to error out. --- src/video/SDL_video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 67a91aec09..819bd13fc1 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3122,7 +3122,8 @@ bool SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h) return SDL_InvalidParamError("max_h"); } - if (max_w < window->min_w || max_h < window->min_h) { + if ((max_w && max_w < window->min_w) || + (max_h && max_h < window->min_h)) { return SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); }