diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 6929866e8..3d14ad051 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -58,7 +58,7 @@ template class Matrix { /** @brief Assignment operator */ inline Matrix& operator=(const Matrix& other) { - setData(other.data()); + if(&other != this) setData(other.data()); return *this; } diff --git a/src/Math/Vector.h b/src/Math/Vector.h index e7c709b10..e5af334d4 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -52,7 +52,7 @@ template class Vector { /** @brief Assignment operator */ inline Vector& operator=(const Vector& other) { - setData(other.data()); + if(&other != this) setData(other.data()); return *this; }