Browse Source

Prevent self-assignment in assignment operator

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
2efd4f2a77
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 5
      src/base/bittorrent/torrentinfo.cpp
  2. 5
      src/base/rss/rss_autodownloadrule.cpp

5
src/base/bittorrent/torrentinfo.cpp

@ -88,7 +88,10 @@ TorrentInfo::TorrentInfo(const TorrentInfo &other)
TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other) TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other)
{ {
m_nativeInfo = other.m_nativeInfo; if (this != &other)
{
m_nativeInfo = other.m_nativeInfo;
}
return *this; return *this;
} }

5
src/base/rss/rss_autodownloadrule.cpp

@ -440,7 +440,10 @@ bool AutoDownloadRule::accepts(const QVariantHash &articleData)
AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other) AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other)
{ {
m_dataPtr = other.m_dataPtr; if (this != &other)
{
m_dataPtr = other.m_dataPtr;
}
return *this; return *this;
} }

Loading…
Cancel
Save