summaryrefslogtreecommitdiffstats
path: root/src/Integer.cpp
diff options
context:
space:
mode:
authorGravatar Tsuk1ha2025-08-20 23:04:42 +0800
committerGravatar Nikias Bassen2025-12-05 00:43:45 +0100
commitb020cf26b8f35aa82a091e02945325af4b2534b0 (patch)
treefa8d6c9f11dbb2099ef2f6df71d7583272869e3e /src/Integer.cpp
parent18e5b22a71f85091127cc063db79c8df687c582c (diff)
downloadlibplist-b020cf26b8f35aa82a091e02945325af4b2534b0.tar.gz
libplist-b020cf26b8f35aa82a091e02945325af4b2534b0.tar.bz2
cpp: Add `this` comparison to `operator=` copy assign
Diffstat (limited to 'src/Integer.cpp')
-rw-r--r--src/Integer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Integer.cpp b/src/Integer.cpp
index 653455d..26e7ccf 100644
--- a/src/Integer.cpp
+++ b/src/Integer.cpp
@@ -41,6 +41,8 @@ Integer::Integer(const PList::Integer& i) : Node(PLIST_INT)
Integer& Integer::operator=(const PList::Integer& i)
{
+ if (this == &i) return *this;
+
plist_free(_node);
_node = plist_copy(i.GetPlist());
return *this;