diff options
-rw-r--r-- | document/src/vespa/document/fieldvalue/variablemap.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/document/src/vespa/document/fieldvalue/variablemap.cpp b/document/src/vespa/document/fieldvalue/variablemap.cpp index be973782eb3..a323ea35851 100644 --- a/document/src/vespa/document/fieldvalue/variablemap.cpp +++ b/document/src/vespa/document/fieldvalue/variablemap.cpp @@ -33,9 +33,11 @@ IndexValue::IndexValue(const IndexValue & rhs) : key(rhs.key ? rhs.key->clone() : nullptr) {} IndexValue & IndexValue::operator = (const IndexValue & rhs) { - IndexValue tmp(rhs); - std::swap(index, tmp.index); - std::swap(key, tmp.key); + if (this != & rhs) { + IndexValue tmp(rhs); + std::swap(index, tmp.index); + std::swap(key, tmp.key); + } return *this; } |