mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
- Catch more exceptions when adding a torrent
This commit is contained in:
@@ -557,6 +557,22 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
||||
QFile::rename(file,file+".corrupt");
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
std::cerr << "Could not decode file, reason: " << e.what() << '\n';
|
||||
// Display warning to tell user we can't decode the torrent file
|
||||
if(!from_url.isNull()) {
|
||||
emit invalidTorrent(from_url);
|
||||
QFile::remove(file);
|
||||
}else{
|
||||
emit invalidTorrent(file);
|
||||
}
|
||||
if(fromScanDir) {
|
||||
// Remove .corrupt file in case it already exists
|
||||
QFile::remove(file+".corrupt");
|
||||
//Rename file extension so that it won't display error message more than once
|
||||
QFile::rename(file,file+".corrupt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check in .priorities file if the user filtered files
|
||||
|
||||
Reference in New Issue
Block a user