From ae99716d9fc84b73ffa2a4af316854a0a8496bac Mon Sep 17 00:00:00 2001 From: Ivan Leontiev Date: Wed, 5 Aug 2015 19:25:11 +0000 Subject: [PATCH] Fixed check for the original url in the Player::HandleLoadResult() --- src/core/player.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/player.cpp b/src/core/player.cpp index 552ef419c..68dd4e2c1 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -113,6 +113,15 @@ void Player::ReloadSettings() { } void Player::HandleLoadResult(const UrlHandler::LoadResult& result) { + // Might've been an async load, so check we're still on the same item + shared_ptr item = app_->playlist_manager()->active()->current_item(); + if (!item) { + loading_async_ = QUrl(); + return; + } + + if (item->Url() != result.original_url_) return; + switch (result.type_) { case UrlHandler::LoadResult::NoMoreTracks: qLog(Debug) << "URL handler for" << result.original_url_ @@ -123,14 +132,6 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) { break; case UrlHandler::LoadResult::TrackAvailable: { - // Might've been an async load, so check we're still on the same item - int current_index = app_->playlist_manager()->active()->current_row(); - if (current_index == -1) return; - - shared_ptr item = - app_->playlist_manager()->active()->item_at(current_index); - if (!item || item->Url() != result.original_url_) return; - qLog(Debug) << "URL handler for" << result.original_url_ << "returned" << result.media_url_;