do_mad_frame_decode might return 0, protect against possible crash

In the song wheel, if you scroll back and forth over an MP3 song very fast, you might get some audible corruption at the beginning of the song preview, and it might even crash the game.

This fixes both of those problems.
This commit is contained in:
sukibaby
2025-03-02 22:21:30 -08:00
committed by teejusb
parent 6f497f70e7
commit 2414595063
+8 -2
View File
@@ -785,8 +785,14 @@ int RageSoundReader_MP3::SetPosition_hard( int iFrame )
/* If we're already past the requested position, rewind. */
if(mad_timer_compare(mad->Timer, desired) > 0)
{
MADLIB_rewind();
do_mad_frame_decode();
if (!MADLIB_rewind())
{
return -1;
}
if (do_mad_frame_decode() <= 0)
{
return -1;
}
synthed = false;
}