diff options
-rw-r--r-- | common/array.h | 3 | ||||
-rw-r--r-- | common/hashmap.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/common/array.h b/common/array.h index 95f3c90ebe..d0be7fa194 100644 --- a/common/array.h +++ b/common/array.h @@ -100,6 +100,9 @@ public: } Array<T>& operator =(const Array<T>& array) { + if (this == &array) + return *this; + if (_data) delete [] _data; _size = array._size; diff --git a/common/hashmap.h b/common/hashmap.h index b5b2bb922b..982e3df70f 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -155,6 +155,9 @@ public: ~HashMap(); HM_t &operator =(const HM_t &map) { + if (this == &map) + return *this; + // Remove the previous content and ... clear(); delete[] _arr; |