Prevent self-assignment in assignment operator

This commit is contained in:
Chocobo1
2021-09-09 21:36:47 +08:00
parent 8f02fe0cc6
commit 2efd4f2a77
2 changed files with 8 additions and 2 deletions

View File

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