fixes a crash when trying to rate the current song if there's none (rate using global shortcut)
This commit is contained in:
parent
302333c36a
commit
5b2625f420
|
@ -1265,9 +1265,13 @@ void Playlist::ReloadItems(const QList<int>& rows) {
|
|||
}
|
||||
|
||||
void Playlist::RateSong(const QModelIndex& index, double rating) {
|
||||
PlaylistItemPtr item = item_at(index.row());
|
||||
if (item && item->IsLocalLibraryItem()) {
|
||||
library_->UpdateSongRatingAsync(item->Metadata().id(), rating);
|
||||
int row = index.row();
|
||||
|
||||
if(has_item_at(row)) {
|
||||
PlaylistItemPtr item = item_at(row);
|
||||
if (item && item->IsLocalLibraryItem()) {
|
||||
library_->UpdateSongRatingAsync(item->Metadata().id(), rating);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@ class Playlist : public QAbstractListModel {
|
|||
bool is_dynamic() const { return dynamic_playlist_; }
|
||||
|
||||
const PlaylistItemPtr& item_at(int index) const { return items_[index]; }
|
||||
const bool has_item_at(int index) const { return index >= 0 && index < rowCount(); }
|
||||
|
||||
PlaylistItemPtr current_item() const { return current_item_; }
|
||||
|
||||
PlaylistItem::Options current_item_options() const;
|
||||
|
|
Loading…
Reference in New Issue