mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-26 22:44:36 +00:00
Fix possibly uncaught invalid_handle exception
This commit is contained in:
parent
29426265a7
commit
15ab369f62
@ -526,7 +526,14 @@ void MainWindow::displayRSSTab() const {
|
||||
void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h) {
|
||||
Preferences pref;
|
||||
if(pref.recursiveDownloadDisabled()) return;
|
||||
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name()));
|
||||
// Get Torrent name
|
||||
QString torrent_name;
|
||||
try {
|
||||
torrent_name = h.name();
|
||||
} catch(invalid_handle&){
|
||||
return;
|
||||
}
|
||||
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(torrent_name));
|
||||
QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||
/*QPushButton *no = */confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
||||
QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole);
|
||||
|
@ -1880,23 +1880,23 @@ void QBtSession::setProxySettings(const proxy_settings &proxySettings) {
|
||||
}
|
||||
|
||||
void QBtSession::recursiveTorrentDownload(const QTorrentHandle &h) {
|
||||
torrent_info::file_iterator it;
|
||||
for(it = h.get_torrent_info().begin_files(); it != h.get_torrent_info().end_files(); it++) {
|
||||
const QString torrent_relpath = h.filepath(*it);
|
||||
if(torrent_relpath.endsWith(".torrent")) {
|
||||
addConsoleMessage(tr("Recursive download of file %1 embedded in torrent %2", "Recursive download of test.torrent embedded in torrent test2").arg(torrent_relpath).arg(h.name()));
|
||||
const QString torrent_fullpath = h.save_path()+QDir::separator()+torrent_relpath;
|
||||
try {
|
||||
try {
|
||||
torrent_info::file_iterator it;
|
||||
for(it = h.get_torrent_info().begin_files(); it != h.get_torrent_info().end_files(); it++) {
|
||||
const QString torrent_relpath = h.filepath(*it);
|
||||
if(torrent_relpath.endsWith(".torrent")) {
|
||||
addConsoleMessage(tr("Recursive download of file %1 embedded in torrent %2", "Recursive download of test.torrent embedded in torrent test2").arg(torrent_relpath).arg(h.name()));
|
||||
const QString torrent_fullpath = h.save_path()+QDir::separator()+torrent_relpath;
|
||||
|
||||
boost::intrusive_ptr<torrent_info> t = new torrent_info(torrent_fullpath.toUtf8().constData());
|
||||
const QString sub_hash = misc::toQString(t->info_hash());
|
||||
// Passing the save path along to the sub torrent file
|
||||
TorrentTempData::setSavePath(sub_hash, h.save_path());
|
||||
addTorrent(torrent_fullpath);
|
||||
} catch(std::exception&) {
|
||||
qDebug("Caught error loading torrent");
|
||||
addConsoleMessage(tr("Unable to decode %1 torrent file.").arg(torrent_fullpath), QString::fromUtf8("red"));
|
||||
}
|
||||
}
|
||||
} catch(std::exception&) {
|
||||
qDebug("Caught error loading torrent");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user