summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-18 10:34:58 +0200
committerDavid Robillard <d@drobilla.net>2020-07-18 10:37:57 +0200
commitcb1b1c5710d207376eee7bb4b9c894c80dd072b3 (patch)
tree3de21e4b3fcfe0f9cc586257271b7eda55ec3ae8
parentffd68a419f6f3530f9bbf98cbe9ff0b2c95c983e (diff)
downloadraul-cb1b1c5710d207376eee7bb4b9c894c80dd072b3.tar.gz
raul-cb1b1c5710d207376eee7bb4b9c894c80dd072b3.tar.bz2
raul-cb1b1c5710d207376eee7bb4b9c894c80dd072b3.zip
Fix Array self-assignment
-rw-r--r--raul/Array.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/raul/Array.hpp b/raul/Array.hpp
index 5ba57a5..cac993d 100644
--- a/raul/Array.hpp
+++ b/raul/Array.hpp
@@ -67,6 +67,10 @@ public:
Array<T>& operator=(const Array<T>& array)
{
+ if (&array == this) {
+ return *this;
+ }
+
_size = array._size;
_elems = _size ? new T[_size] : nullptr;