fix crash when GetEndFrame() < m_iPositionFrames due to jumped position

This commit is contained in:
Glenn Maynard
2007-01-09 00:26:56 +00:00
parent 258140f50a
commit 55195a502f
+6 -1
View File
@@ -49,7 +49,12 @@ int RageSoundReader_Extend::GetData( char *pBuffer, int iFrames )
{
int iFramesToRead = iFrames;
if( m_iLengthFrames != -1 )
iFramesToRead = min( iFramesToRead, GetEndFrame() - m_iPositionFrames );
{
int iFramesLeft = GetEndFrame() - m_iPositionFrames;
iFramesLeft = max( 0, iFramesLeft );
iFramesToRead = min( iFramesToRead, iFramesLeft );
}
if( iFrames && !iFramesToRead )
return RageSoundReader::END_OF_FILE;