diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index d98a9d375..b198dfda5 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -378,6 +377,8 @@ void AddNewTorrentDialog::renameSelectedFile() if (selectedIndexes.size() != 1) return; const QModelIndex &index = selectedIndexes.first(); + if (!index.isValid()) + return; // Ask for new name bool ok; const QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"), diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 9ecc836e9..3a0e6acf8 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -536,6 +536,8 @@ void PropertiesWidget::renameSelectedFile() { if (selectedIndexes.size() != 1) return; const QModelIndex index = selectedIndexes.first(); + if (!index.isValid()) + return; // Ask for new name bool ok; QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),