BUGFIX: Fix possible crash when changing the save path in addition dialog

This commit is contained in:
Christophe Dumez
2010-09-27 17:35:34 +00:00
parent 7ab7f4b0fc
commit c554528afe
2 changed files with 6 additions and 1 deletions

View File

@@ -120,9 +120,13 @@ void torrentAdditionDialog::saveSettings() {
}
void torrentAdditionDialog::renameTorrentNameInModel(QString file_path) {
file_path = file_path.trimmed();
if(file_path.isEmpty()) return;
file_path = file_path.replace("\\", "/");
// Rename in torrent files model too
PropListModel->setData(PropListModel->index(0, 0), file_path.split("/", QString::SkipEmptyParts).last());
QStringList parts = file_path.split("/", QString::SkipEmptyParts);
if(!parts.empty())
PropListModel->setData(PropListModel->index(0, 0), parts.last());
}
void torrentAdditionDialog::limitDialogWidth() {