summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 10:06:49 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 10:06:49 +0000
commita1119230621d3ab26e93466a6838be42aaa83307 (patch)
tree3bc13f67b313268a7d7a1e15c108eb40e995e3c3 /hash.c
parent5dc77048a3854a74113c62f2d942f3a45d9ad9bf (diff)
hash.c: fix segv in Hash#replace
* hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced in r44060 [Bug #9230] [ruby-core:58991] * test/ruby/test_hash.rb: regression test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 53d70f9fe7..a6944770a6 100644
--- a/hash.c
+++ b/hash.c
@@ -1414,7 +1414,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
table2 = RHASH(hash2)->ntbl;
rb_hash_clear(hash);
- hash_tbl(hash)->type = table2->type;
+ if (table2) hash_tbl(hash)->type = table2->type;
rb_hash_foreach(hash2, replace_i, hash);
return hash;