Fix OOB access when stopping a sound that has invalid samples

This commit is contained in:
Robert Müller 2022-06-26 22:38:47 +02:00
parent 9932bd76fb
commit 9390ae99b2

View file

@ -228,10 +228,10 @@ void CSounds::Stop(int SetId)
if(m_WaitForSoundJob || SetId < 0 || SetId >= g_pData->m_NumSounds)
return;
CDataSoundset *pSet = &g_pData->m_aSounds[SetId];
const CDataSoundset *pSet = &g_pData->m_aSounds[SetId];
for(int i = 0; i < pSet->m_NumSounds; i++)
Sound()->Stop(pSet->m_aSounds[i].m_Id);
if(pSet->m_aSounds[i].m_Id != -1)
Sound()->Stop(pSet->m_aSounds[i].m_Id);
}
bool CSounds::IsPlaying(int SetId)