diff options
author | David Robillard <d@drobilla.net> | 2012-05-13 23:15:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-13 23:15:20 +0000 |
commit | 52e92126896c9d4e2ed2e0f3db7dd70809a473d6 (patch) | |
tree | 164a40b5797955160cefd48e0b101a9aa1183077 /raul | |
parent | 34e2926ae927b17a2539586bb79f4fa5338dfc05 (diff) | |
download | raul-52e92126896c9d4e2ed2e0f3db7dd70809a473d6.tar.gz raul-52e92126896c9d4e2ed2e0f3db7dd70809a473d6.tar.bz2 raul-52e92126896c9d4e2ed2e0f3db7dd70809a473d6.zip |
Gracefully handle self-assignment.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4400 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul')
-rw-r--r-- | raul/Atom.hpp | 3 | ||||
-rw-r--r-- | raul/Configuration.hpp | 3 |
2 files changed, 6 insertions, 0 deletions
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); } |