Fix crash in ProjectileManager when a sound id fails to play or is not found

pull/124/head
scrawl 8 years ago
parent 911807ad4f
commit 7b5f3e3cdc

@ -280,7 +280,9 @@ namespace MWWorld
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
for (size_t it = 0; it != state.mSoundIds.size(); it++)
{
state.mSounds.push_back(sndMgr->playSound3D(pos, state.mSoundIds.at(it), 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop));
MWBase::SoundPtr sound = sndMgr->playSound3D(pos, state.mSoundIds.at(it), 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop);
if (sound)
state.mSounds.push_back(sound);
}
mMagicBolts.push_back(state);
@ -571,8 +573,10 @@ namespace MWWorld
for (size_t soundIter = 0; soundIter != state.mSoundIds.size(); soundIter++)
{
state.mSounds.push_back(sndMgr->playSound3D(esm.mPosition, state.mSoundIds.at(soundIter), 1.0f, 1.0f,
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop));
MWBase::SoundPtr sound = sndMgr->playSound3D(esm.mPosition, state.mSoundIds.at(soundIter), 1.0f, 1.0f,
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop);
if (sound)
state.mSounds.push_back(sound);
}
mMagicBolts.push_back(state);

Loading…
Cancel
Save