summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-06 15:44:26 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-06 15:44:26 +0000
commitb0eab6daaf92edd20af4b1d15bb689facab3f409 (patch)
tree59d9d60fc40b48cde2882bc34e7e1ea5b4acdb48 /hash.c
parent6234672a9d1f1da588f61e7db0a2df66ae901076 (diff)
* hash.c (rb_hash_default): should not call default procedure if
no key is given. [ruby-list:42541] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index eec6a71..dc804eb 100644
--- a/hash.c
+++ b/hash.c
@@ -508,6 +508,7 @@ rb_hash_default(argc, argv, hash)
rb_scan_args(argc, argv, "01", &key);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
+ if (argc == 0) return Qnil;
return rb_funcall(RHASH(hash)->ifnone, id_call, 2, hash, key);
}
return RHASH(hash)->ifnone;