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