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