From b020cf26b8f35aa82a091e02945325af4b2534b0 Mon Sep 17 00:00:00 2001 From: Tsuk1ha Date: Wed, 20 Aug 2025 23:04:42 +0800 Subject: cpp: Add `this` comparison to `operator=` copy assign --- src/Boolean.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Boolean.cpp') diff --git a/src/Boolean.cpp b/src/Boolean.cpp index 9ec1a63..2a5e303 100644 --- a/src/Boolean.cpp +++ b/src/Boolean.cpp @@ -40,6 +40,8 @@ Boolean::Boolean(const PList::Boolean& b) : Node(PLIST_BOOLEAN) Boolean& Boolean::operator=(const PList::Boolean& b) { + if (this == &b) return *this; + plist_free(_node); _node = plist_copy(b.GetPlist()); return *this; -- cgit v1.1-32-gdbae