summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-info.h
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-10-16 22:03:46 -0400
committerNeil Moore <neil@s-z.org>2013-10-16 22:03:46 -0400
commit085050246da27761d57e12145f850233203a4ae5 (patch)
treea21ca8294580f4274492c2c9f1cc2b93ba28fdaa /crawl-ref/source/mon-info.h
parent6aec31b66f9085e9666c637a04d7d7dc817d4ebf (diff)
downloadcrawl-ref-085050246da27761d57e12145f850233203a4ae5.tar.gz
crawl-ref-085050246da27761d57e12145f850233203a4ae5.zip
Fix some assignment operators.
These three did not properly handle self-assignment.
Diffstat (limited to 'crawl-ref/source/mon-info.h')
-rw-r--r--crawl-ref/source/mon-info.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-info.h b/crawl-ref/source/mon-info.h
index a806f58acd..1dbb452a9c 100644
--- a/crawl-ref/source/mon-info.h
+++ b/crawl-ref/source/mon-info.h
@@ -169,8 +169,11 @@ struct monster_info : public monster_info_base
monster_info& operator=(const monster_info& p)
{
- this->~monster_info();
- new (this) monster_info(p);
+ if (this != &p)
+ {
+ this->~monster_info();
+ new (this) monster_info(p);
+ }
return *this;
}