1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Don't display the context menu in 'Content' and 'HTTP Sources' buttons when no torrent is selected. It prevents crashes. Closes #1906, #1900.

This commit is contained in:
sledgehammer999 2014-08-30 19:52:57 +03:00
parent de5ad05d0a
commit 94fc2f9c3d

View File

@ -466,6 +466,8 @@ void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_fold
} }
void PropertiesWidget::displayFilesListMenu(const QPoint&) { void PropertiesWidget::displayFilesListMenu(const QPoint&) {
if (!h.is_valid())
return;
QMenu myFilesLlistMenu; QMenu myFilesLlistMenu;
QModelIndexList selectedRows = filesList->selectionModel()->selectedRows(0); QModelIndexList selectedRows = filesList->selectionModel()->selectedRows(0);
QAction *actOpen = 0; QAction *actOpen = 0;
@ -521,6 +523,8 @@ void PropertiesWidget::displayFilesListMenu(const QPoint&) {
} }
void PropertiesWidget::displayWebSeedListMenu(const QPoint&) { void PropertiesWidget::displayWebSeedListMenu(const QPoint&) {
if (!h.is_valid())
return;
QMenu seedMenu; QMenu seedMenu;
QModelIndexList rows = listWebSeeds->selectionModel()->selectedRows(); QModelIndexList rows = listWebSeeds->selectionModel()->selectedRows();
QAction *actAdd = seedMenu.addAction(IconProvider::instance()->getIcon("list-add"), tr("New Web seed")); QAction *actAdd = seedMenu.addAction(IconProvider::instance()->getIcon("list-add"), tr("New Web seed"));