summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 68f978081c..30aa03101e 100644
--- a/hash.c
+++ b/hash.c
@@ -1240,6 +1240,8 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2)
Check_Type(hash2, T_HASH);
+ if (hash == hash2) return hash;
+
ntbl = RHASH(hash)->ntbl;
if (RHASH(hash2)->ntbl) {
if (ntbl) st_free_table(ntbl);