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

From a0ca3109b1c913e71beccaf231eeb0deb64c857e 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

(cherry picked from commit 3ec4fee45c920e0eb86324124c55b8cd9c4f4d0c)
---
 src/mixer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mixer.c b/src/mixer.c
index a8a48c77..d26a6f1d 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -1051,6 +1051,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;