Check that popular_month_, popular_today_ and stations_ still exist (i.e. aren't NULL) when we receive replies.
Indeed, we do not need to be logged in to get results for popular songs and get stations tags. But if the user has been automatically logged out (e.g. session_id not valid anymore) these items have been deleted.
This commit is contained in:
parent
5f0f50435c
commit
e0d61eb66c
|
@ -755,6 +755,8 @@ void GroovesharkService::PopularSongsMonthRetrieved(QNetworkReply* reply) {
|
|||
reply->deleteLater();
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
SongList songs = ExtractSongs(result);
|
||||
if (!popular_month_)
|
||||
return;
|
||||
foreach (const Song& song, songs) {
|
||||
QStandardItem* child = new QStandardItem(song.PrettyTitleWithArtist());
|
||||
child->setData(Type_Track, InternetModel::Role_Type);
|
||||
|
@ -783,6 +785,8 @@ void GroovesharkService::PopularSongsTodayRetrieved(QNetworkReply* reply) {
|
|||
reply->deleteLater();
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
SongList songs = ExtractSongs(result);
|
||||
if (!popular_today_)
|
||||
return;
|
||||
foreach (const Song& song, songs) {
|
||||
QStandardItem* child = new QStandardItem(song.PrettyTitleWithArtist());
|
||||
child->setData(Type_Track, InternetModel::Role_Type);
|
||||
|
@ -840,6 +844,8 @@ void GroovesharkService::AutoplayTagsRetrieved(QNetworkReply* reply) {
|
|||
reply->deleteLater();
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
QVariantMap::const_iterator it;
|
||||
if (!stations_)
|
||||
return;
|
||||
for (it = result.constBegin(); it != result.constEnd(); ++it) {
|
||||
int id = it.key().toInt();
|
||||
QString name = it.value().toString().toLower();
|
||||
|
|
Loading…
Reference in New Issue