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/Date.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Date.cpp') diff --git a/src/Date.cpp b/src/Date.cpp index cbfa123..214220b 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -40,6 +40,8 @@ Date::Date(const PList::Date& d) : Node(PLIST_DATE) Date& Date::operator=(const PList::Date& d) { + if (this == &d) return *this; + plist_free(_node); _node = plist_copy(d.GetPlist()); return *this; -- cgit v1.1-32-gdbae