fixed m_oldMusic.push_back(nullptr) and segfault

dev-ui
andreymal 2014-03-02 18:00:02 +04:00
parent fef338da24
commit 1a0dcedf83
1 changed files with 9 additions and 7 deletions

View File

@ -514,7 +514,6 @@ void ALSound::FrameMove(float delta)
{ {
continue; continue;
} }
if (it.second->IsMuted()) if (it.second->IsMuted())
{ {
it.second->SetVolume(0.0f); it.second->SetVolume(0.0f);
@ -685,6 +684,8 @@ bool ALSound::PlayMusic(const std::string &filename, bool bRepeat, float fadeTim
bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat) bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
{ {
if (m_previousMusic.fadeTime > 0.0f) if (m_previousMusic.fadeTime > 0.0f)
{
if(m_currentMusic)
{ {
OldMusic old; OldMusic old;
old.music = m_currentMusic; old.music = m_currentMusic;
@ -693,6 +694,7 @@ bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
m_oldMusic.push_back(old); m_oldMusic.push_back(old);
m_currentMusic = nullptr; m_currentMusic = nullptr;
} }
}
else else
{ {
if (m_currentMusic) if (m_currentMusic)