|
From: Peque <ms...@us...> - 2010-01-08 19:08:04
|
Module: performous
Branch: master
Commit: 66dda1c63eb8832f91b0380d4ec010906eee9f04
Author: Miguel Sánchez de León Peque <peq...@ho...>
Date: Fri Jan 8 20:07:06 2010 +0100
Fixed crash in last commit when no songs match filter.
---
game/screen_songs.cc | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index b47283e..f2e39db 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -150,8 +150,10 @@ void ScreenSongs::stopMultimedia(ScreenSharedInfo& info) {
// Play/stop preview playback (if it is the time)
if (info.music != m_playing && m_playTimer.get() > 0.3) {
m_songbg.reset(); m_video.reset();
- if (m_songs.current().preview_start > 5.0) m_songs.current().preview_start = 5.0; ///< this line is for performance (don't touch it unless you implement better seeking method in songs)
- if (info.music.empty()) m_audio.fadeout(1.0); else m_audio.playMusic(info.music, true, 2.0, (m_songs.current().preview_start ? m_songs.current().preview_start : 5.0));
+ double pstart = 0;
+ if (!m_songs.empty()) pstart = m_songs.current().preview_start;
+ pstart = (pstart == pstart) ? std::min(pstart, 5.0) : 5.0; ///< this line is for performance (don't remove it unless you implement better seeking method in songs)
+ if (info.music.empty()) m_audio.fadeout(1.0); else m_audio.playMusic(info.music, true, 2.0, (pstart ? pstart : 5.0));
if (!info.songbg.empty()) try { m_songbg.reset(new Surface(info.songbg)); } catch (std::exception const&) {}
if (!info.video.empty() && config["graphic/video"].b()) m_video.reset(new Video(info.video, info.videoGap));
m_playing = info.music;
|