From 52e92126896c9d4e2ed2e0f3db7dd70809a473d6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 13 May 2012 23:15:20 +0000 Subject: Gracefully handle self-assignment. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4400 a436a847-0d15-0410-975c-d299462d15a1 --- raul/Atom.hpp | 3 +++ raul/Configuration.hpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'raul') diff --git a/raul/Atom.hpp b/raul/Atom.hpp index 8717964..c657fbf 100644 --- a/raul/Atom.hpp +++ b/raul/Atom.hpp @@ -59,6 +59,9 @@ public: } Atom& operator=(const Atom& other) { + if (&other == this) { + return *this; + } dealloc(); _size = other._size; _type = other._type; diff --git a/raul/Configuration.hpp b/raul/Configuration.hpp index f01809d..554b247 100644 --- a/raul/Configuration.hpp +++ b/raul/Configuration.hpp @@ -80,6 +80,9 @@ public: Value& operator=(const Value& other) { + if (&other == this) { + return *this; + } if (_type == STRING) { free(_val._string); } -- cgit v1.2.1