self-assignment bug in hsTArray

The following code:
- Code: Select all
hsTArray a;
a = a
- Code: Select all
Index: core/Util/hsTArray.hpp
===================================================================
--- core/Util/hsTArray.hpp (revision 359)
+++ core/Util/hsTArray.hpp (working copy)
@@ -26,6 +26,8 @@
}
hsTArray<T>& operator=(const hsTArray& cpy) {
+ if (&cpy == this) return *this;
+
clear();
count = cpy.count;
data = new T[count];