SDL_mixer: Clamp the parameter to Mix_ReserveChannels() to positive values

From 3ec4fee45c920e0eb86324124c55b8cd9c4f4d0c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 14 Jan 2024 09:56:27 -0800
Subject: [PATCH] Clamp the parameter to Mix_ReserveChannels() to positive
 values

Fixes https://github.com/libsdl-org/SDL_mixer/issues/417
---
 src/mixer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mixer.c b/src/mixer.c
index a2de6559..6c6d7a9f 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -1032,6 +1032,8 @@ void Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel))
  */
 int Mix_ReserveChannels(int num)
 {
+    if (num < 0)
+        num = 0;
     if (num > num_channels)
         num = num_channels;
     reserved_channels = num;