]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/variant.h
Check for self-assignment in non-trivial assignment operators
[libs/core.git] / source / core / variant.h
index 443befb481620b4242e178a4b377192179af1adc..338ec90865d5a8dc0dc269e96f73577b1c42c04c 100644 (file)
@@ -69,6 +69,9 @@ public:
 
        Variant &operator=(const Variant &v)
        {
+               if(&v==this)
+                       return *this;
+
                delete store;
                store = (v.store ? v.store->clone() : nullptr);
                return *this;