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/Array.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Array.cpp') diff --git a/src/Array.cpp b/src/Array.cpp index 49b8924..784df7c 100644 --- a/src/Array.cpp +++ b/src/Array.cpp @@ -62,6 +62,8 @@ Array::Array(const PList::Array& a) : Structure(a.GetParent()) Array& Array::operator=(const PList::Array& a) { + if (this == &a) return *this; + plist_free(_node); for (size_t it = 0; it < _array.size(); it++) { delete _array.at(it); -- cgit v1.1-32-gdbae