- Fix detection of invalid torrent files

This commit is contained in:
Christophe Dumez
2010-01-03 13:04:26 +00:00
parent f39d3296ab
commit 893b7bf7f3
3 changed files with 7 additions and 0 deletions

View File

@@ -794,6 +794,8 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
try {
// Getting torrent file informations
t = new torrent_info(file.toLocal8Bit().data());
if(!t->is_valid())
throw std::exception();
} catch(std::exception&) {
if(!from_url.isNull()) {
addConsoleMessage(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(from_url), QString::fromUtf8("red"));