Browse Source

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.
Frank Praznik 10 months ago
parent
commit
2762644e96
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/video/SDL_video.c

+ 2 - 1
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");
         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");
         return SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
     }
     }