Browse Source

Simplify code

This avoids "deferencing null pointer" warning from static analyzers.
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
42eac2ee3c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/session.cpp

4
src/base/bittorrent/session.cpp

@ -2204,8 +2204,8 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
// processed or adding to session // processed or adding to session
if (m_addingTorrents.contains(hash) || m_loadedMetadata.contains(hash)) return false; if (m_addingTorrents.contains(hash) || m_loadedMetadata.contains(hash)) return false;
if (m_torrents.contains(hash)) { TorrentHandle *const torrent = m_torrents.value(hash);
TorrentHandle *const torrent = m_torrents.value(hash); if (torrent) {
if (torrent->isPrivate() || (!fromMagnetUri && torrentInfo.isPrivate())) if (torrent->isPrivate() || (!fromMagnetUri && torrentInfo.isPrivate()))
return false; return false;
torrent->addTrackers(fromMagnetUri ? magnetUri.trackers() : torrentInfo.trackers()); torrent->addTrackers(fromMagnetUri ? magnetUri.trackers() : torrentInfo.trackers());

Loading…
Cancel
Save