aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/numbertheory/pow_mod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math/numbertheory/pow_mod.cpp')
-rw-r--r--src/lib/math/numbertheory/pow_mod.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/math/numbertheory/pow_mod.cpp b/src/lib/math/numbertheory/pow_mod.cpp
index 49ff6cca2..5503f313c 100644
--- a/src/lib/math/numbertheory/pow_mod.cpp
+++ b/src/lib/math/numbertheory/pow_mod.cpp
@@ -34,10 +34,15 @@ Power_Mod::Power_Mod(const Power_Mod& other)
*/
Power_Mod& Power_Mod::operator=(const Power_Mod& other)
{
- delete m_core;
- m_core = nullptr;
- if(other.m_core)
- m_core = other.m_core->copy();
+ if(this != &other)
+ {
+ delete m_core;
+ m_core = nullptr;
+ if(other.m_core)
+ {
+ m_core = other.m_core->copy();
+ }
+ }
return (*this);
}