]> git.tdb.fi Git - libs/core.git/blobdiff - source/strings/format.cpp
Check for self-assignment in non-trivial assignment operators
[libs/core.git] / source / strings / format.cpp
index d2065e91cad058cd74f63fa5a34dcec45f258cde..42926e158d593a8a5d84ffb88dfcdddce26a80d5 100644 (file)
@@ -19,6 +19,9 @@ Formatter::Formatter(const Formatter &other):
 
 Formatter &Formatter::operator=(const Formatter &other)
 {
+       if(&other==this)
+               return *this;
+
        fmt = other.fmt;
        pos = fmt.begin()+(other.pos-other.fmt.begin());
        result = other.result;