Fix crash when trying to download a track, but there is no current one playing.
This commit is contained in:
parent
30346e7810
commit
c9b39e7c83
@ -64,15 +64,23 @@ SongSender::~SongSender() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SongSender::SendSongs(const pb::remote::RequestDownloadSongs& request) {
|
void SongSender::SendSongs(const pb::remote::RequestDownloadSongs& request) {
|
||||||
Song current_song = app_->player()->GetCurrentItem()->Metadata();
|
Song current_song;
|
||||||
|
if (app_->player()->GetCurrentItem()) {
|
||||||
|
current_song = app_->player()->GetCurrentItem()->Metadata();
|
||||||
|
}
|
||||||
|
|
||||||
switch (request.download_item()) {
|
switch (request.download_item()) {
|
||||||
case pb::remote::CurrentItem: {
|
case pb::remote::CurrentItem: {
|
||||||
DownloadItem item(current_song, 1, 1);
|
if (current_song.is_valid()) {
|
||||||
download_queue_.append(item);
|
DownloadItem item(current_song, 1, 1);
|
||||||
|
download_queue_.append(item);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case pb::remote::ItemAlbum:
|
case pb::remote::ItemAlbum:
|
||||||
SendAlbum(current_song);
|
if (current_song.is_valid()) {
|
||||||
|
SendAlbum(current_song);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case pb::remote::APlaylist:
|
case pb::remote::APlaylist:
|
||||||
SendPlaylist(request.playlist_id());
|
SendPlaylist(request.playlist_id());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user