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 87438dfbf8..ccc0d448f1 100644
--- a/hash.c
+++ b/hash.c
@@ -1403,6 +1403,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);