aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/numbertheory/pow_mod.cpp
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-01-11 11:55:42 +0100
committerDaniel Neus <[email protected]>2016-03-05 19:50:29 +0100
commitf95cd9245d2e889a756b187452dafaf68e795179 (patch)
treed0d8afe2159821f3c89545ea7711fba05c97e720 /src/lib/math/numbertheory/pow_mod.cpp
parenta3ce0bd1e9e018ea69741c4380bf065cccedec93 (diff)
Remaining cppcheck fixes that are not covered by GH #444
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);
}