summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/array.c b/array.c
index c4869789e5..775fb243bd 100644
--- a/array.c
+++ b/array.c
@@ -3908,7 +3908,9 @@ ary_add_hash(VALUE hash, VALUE ary)
for (i=0; i<RARRAY_LEN(ary); i++) {
VALUE elt = RARRAY_AREF(ary, i);
- rb_hash_aset(hash, elt, elt);
+ if (rb_hash_lookup2(hash, elt, Qundef) == Qundef) {
+ rb_hash_aset(hash, elt, elt);
+ }
}
return hash;
}