Skip to content

Commit

Permalink
Clamp the parameter to Mix_ReserveChannels() to positive values
Browse files Browse the repository at this point in the history
Fixes #417

(cherry picked from commit 3ec4fee)
  • Loading branch information
slouken committed Jan 14, 2024
1 parent 6b682a2 commit a0ca310
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a0ca310

Please sign in to comment.