1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Add bounds check to musicclass::play()

If the song number (after we've processed it) is out-of-bounds, then
just return and log the error.
This commit is contained in:
Misa 2020-06-30 17:17:29 -07:00 committed by Ethan Lee
parent 7c2b418761
commit 5fe3b9d0de

View File

@ -163,6 +163,12 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
if (t != -1)
{
currentsong = t;
if (!INBOUNDS(t, musicTracks))
{
puts("play() out-of-bounds!");
currentsong = -1;
return;
}
if (currentsong == 0 || currentsong == 7 || (!map.custommode && (currentsong == 0+num_pppppp_tracks || currentsong == 7+num_pppppp_tracks)))
{
// Level Complete theme, no fade in or repeat