mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
Avoid dereferencing null pointers
PR #16896. Closes #16884 and similar issues.
This commit is contained in:
parent
b740cc23d3
commit
359c4fef9d
@ -4150,7 +4150,8 @@ void Session::handleTorrentMetadataReceived(TorrentImpl *const torrent)
|
||||
if (!torrentExportDirectory().isEmpty())
|
||||
{
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const TorrentInfo torrentInfo {*torrent->nativeHandle().torrent_file_with_hashes()};
|
||||
const std::shared_ptr<lt::torrent_info> completeTorrentInfo = torrent->nativeHandle().torrent_file_with_hashes();
|
||||
const TorrentInfo torrentInfo {*(completeTorrentInfo ? completeTorrentInfo : torrent->nativeHandle().torrent_file())};
|
||||
#else
|
||||
const TorrentInfo torrentInfo {*torrent->nativeHandle().torrent_file()};
|
||||
#endif
|
||||
@ -4209,7 +4210,8 @@ void Session::handleTorrentFinished(TorrentImpl *const torrent)
|
||||
if (!finishedTorrentExportDirectory().isEmpty())
|
||||
{
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const TorrentInfo torrentInfo {*torrent->nativeHandle().torrent_file_with_hashes()};
|
||||
const std::shared_ptr<lt::torrent_info> completeTorrentInfo = torrent->nativeHandle().torrent_file_with_hashes();
|
||||
const TorrentInfo torrentInfo {*(completeTorrentInfo ? completeTorrentInfo : torrent->nativeHandle().torrent_file())};
|
||||
#else
|
||||
const TorrentInfo torrentInfo {*torrent->nativeHandle().torrent_file()};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user