Fix possible underflow issue

Pointed out by nedwill_3ds here:
https://www.reddit.com/r/3dshacks/comments/5nl1zi/wip_ctrmus_3ds_music_player/dcciivz/

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-01-12 21:27:25 +00:00
parent dd2ec58dc0
commit e573b497eb

View File

@@ -100,12 +100,13 @@ uint64_t fillOpusBuffer(OggOpusFile* opusFile, int16_t* bufferOut)
while(samplesToRead > 0)
{
uint64_t samplesJustRead = op_read_stereo(opusFile, bufferOut,
int samplesJustRead = op_read_stereo(opusFile, bufferOut,
samplesToRead > 120*48*2 ? 120*48*2 : samplesToRead);
if(samplesJustRead < 0)
{
printf("\nFatal error decoding Opus: %llu.", samplesJustRead);
/* TODO: Printing should not be done here. */
printf("\nFatal error decoding Opus: %d.", samplesJustRead);
return 0;
}
else if(samplesJustRead == 0)