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.
This commit is contained in:
Frank Praznik 2024-12-02 09:47:25 -05:00
parent 068d9cc7d6
commit 2762644e96
1 changed files with 2 additions and 1 deletions

View File

@ -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");
}