Don't load the moodbar if the song was stopped

When an async moodbar load completes, it checks to see if the song is still playing and should update the UI.
It however failed to check if the song was stopped, so it would load a moodbar when no song is playing.
It now checks the player state before emitting a change.
This commit is contained in:
Mark Furneaux 2014-12-22 16:53:58 -05:00
parent 3886f3d1e4
commit a4be57414a
1 changed files with 11 additions and 0 deletions

View File

@ -69,6 +69,17 @@ void MoodbarController::AsyncLoadComplete(MoodbarPipeline* pipeline,
if (current_item && current_item->Url() != url) {
return;
}
// Did we stop the song?
switch(app_->player()->GetState()) {
case Engine::Error:
case Engine::Empty:
case Engine::Idle:
return;
break;
default:
break;
}
emit CurrentMoodbarDataChanged(pipeline->data());
}