1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-31 11:35:24 +01:00

Make 'ExtractSongs' not return valid song if 'result' is invalid/empty

This commit is contained in:
Arnaud Bienner 2011-12-01 21:46:16 +01:00
parent 0023e4faf6
commit 74ea844811
2 changed files with 18 additions and 17 deletions

View File

@ -52,7 +52,7 @@ PlaylistItemList GroovesharkRadio::Generate() {
song = service_->StartAutoplay(autoplay_state_);
}
// If the song url isn't valid, stop here
if (song.url().toString() == "grooveshark://0/0/0") {
if (!song.is_valid()) {
return items;
}
PlaylistItemPtr playlist_item = PlaylistItemPtr(new InternetPlaylistItem(service_, song));
@ -60,7 +60,7 @@ PlaylistItemList GroovesharkRadio::Generate() {
first_time_ = false;
}
Song song = service_->GetAutoplaySong(autoplay_state_);
if (song.url().toString() == "grooveshark://0/0/0") {
if (!song.is_valid()) {
return items;
}
PlaylistItemPtr playlist_item = PlaylistItemPtr(new InternetPlaylistItem(service_, song));

View File

@ -1430,6 +1430,7 @@ SongList GroovesharkService::ExtractSongs(const QVariantMap& result) {
Song GroovesharkService::ExtractSong(const QVariantMap& result_song) {
Song song;
if (!result_song.isEmpty()) {
int song_id = result_song["SongID"].toInt();
QString song_name = result_song["SongName"].toString();
int artist_id = result_song["ArtistID"].toInt();
@ -1444,7 +1445,7 @@ Song GroovesharkService::ExtractSong(const QVariantMap& result_song) {
// URL when user will actually play the song (through url handler)
// URL is grooveshark://artist_id/album_id/song_id
song.set_url(QString("grooveshark://%1/%2/%3").arg(artist_id).arg(album_id).arg(song_id));
}
return song;
}