From 3e0e3f6889037754e7a0d2549fc168580d51020c Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 22 Mar 2010 21:36:02 +0000 Subject: [PATCH] Actually check for errors in AlbumCoverFetcher. --- src/albumcoverfetcher.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/albumcoverfetcher.cpp b/src/albumcoverfetcher.cpp index ab3cd30e0..8358a9219 100644 --- a/src/albumcoverfetcher.cpp +++ b/src/albumcoverfetcher.cpp @@ -65,6 +65,12 @@ void AlbumCoverFetcher::AlbumGetInfoFinished() { reply->deleteLater(); quint64 id = active_requests_.take(reply); + if (reply->error() != QNetworkReply::NoError) { + // TODO: retry request. + emit AlbumCoverFetched(id, QImage()); + return; + } + try { lastfm::XmlQuery query(lastfm::ws::parse(reply)); @@ -81,10 +87,16 @@ void AlbumCoverFetcher::AlbumGetInfoFinished() { void AlbumCoverFetcher::AlbumCoverFetchFinished() { QNetworkReply* reply = qobject_cast(sender()); reply->deleteLater(); + quint64 id = active_requests_.take(reply); + + if (reply->error() != QNetworkReply::NoError) { + // TODO: retry request. + emit AlbumCoverFetched(id, QImage()); + return; + } QImage image; image.loadFromData(reply->readAll()); - quint64 id = active_requests_.take(reply); emit AlbumCoverFetched(id, image); }