mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Catch more exceptions when adding a torrent
This commit is contained in:
parent
5e86c8a14d
commit
07c195f475
2 changed files with 36 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue