mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-15 18:58:55 +01:00
Check the playlist context menu index is valid before getting data from it. Fixes issue #109
This commit is contained in:
parent
70b6ba8c39
commit
ad30bad33c
@ -585,18 +585,22 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex&
|
||||
ui_.action_renumber_tracks->setEnabled(editable);
|
||||
ui_.action_selection_set_value->setEnabled(editable >= 2);
|
||||
|
||||
Playlist::Column column = (Playlist::Column)playlist_menu_index_.column();
|
||||
ui_.action_selection_set_value->setVisible(
|
||||
column <= Playlist::Column_Genre &&
|
||||
column != Playlist::Column_Length);
|
||||
if (!index.isValid()) {
|
||||
ui_.action_selection_set_value->setVisible(false);
|
||||
} else {
|
||||
Playlist::Column column = (Playlist::Column)index.column();
|
||||
ui_.action_selection_set_value->setVisible(
|
||||
column <= Playlist::Column_Genre &&
|
||||
column != Playlist::Column_Length);
|
||||
|
||||
QString column_name = Playlist::column_name(column);
|
||||
QString column_value = playlist_->data(playlist_menu_index_).toString();
|
||||
if (column_value.length() > 25)
|
||||
column_value = column_value.left(25) + "...";
|
||||
QString column_name = Playlist::column_name(column);
|
||||
QString column_value = playlist_->data(index).toString();
|
||||
if (column_value.length() > 25)
|
||||
column_value = column_value.left(25) + "...";
|
||||
|
||||
ui_.action_selection_set_value->setText(tr("Set %1 to \"%2\"...")
|
||||
.arg(column_name.toLower()).arg(column_value));
|
||||
ui_.action_selection_set_value->setText(tr("Set %1 to \"%2\"...")
|
||||
.arg(column_name.toLower()).arg(column_value));
|
||||
}
|
||||
|
||||
playlist_menu_->popup(global_pos);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user