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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user