From 60889cac790cc625348e681aacded35679475adb Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 27 Dec 2008 21:25:58 +0000 Subject: [PATCH] - Catch exceptions on torrent aditions to avoid crashing because of a bad torrent (that is correctly loaded by torrent_info for some reason) --- src/bittorrent.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index f1ecdeb9b..c94c9d81d 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -456,7 +456,11 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo p.duplicate_is_error = false; // Already checked p.auto_managed = false; // Because it is added in paused state // Adding torrent to bittorrent session - h = QTorrentHandle(s->add_torrent(p)); + try { + h = QTorrentHandle(s->add_torrent(p)); + }catch(std::exception e){ + qDebug("Error: %s", e.what()); + } // Check if it worked if(!h.is_valid()) { // No need to keep on, it failed.