summaryrefslogtreecommitdiffstats
path: root/ext/readline
diff options
context:
space:
mode:
authorkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-03 12:15:20 +0000
committerkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-03 12:15:20 +0000
commit7050c8b4093e0eb1d8e83cbb6f704fb5f66b50a7 (patch)
treef72ba5908d00216268ca39377b176fa42ef41449 /ext/readline
parente646f22553ffda0dbef5aa20dbe51bf3d3a2b683 (diff)
downloadruby-7050c8b4093e0eb1d8e83cbb6f704fb5f66b50a7.tar.gz
ruby-7050c8b4093e0eb1d8e83cbb6f704fb5f66b50a7.tar.xz
ruby-7050c8b4093e0eb1d8e83cbb6f704fb5f66b50a7.zip
* ext/readline/readline.c (readline_s_set_completion_proc): set
default if proc is nil. fix #1095 git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 7912989c2..feab70fb3 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -304,6 +304,8 @@ readline_s_set_output(VALUE self, VALUE output)
* should take input-string, and return an array of completion
* candidates.
*
+ * Set default if +proc+ is nil.
+ *
* Raises ArgumentError exception if +proc+ does not respond to call method.
*
* Raises SecurityError exception if $SAFE is 4.
@@ -312,7 +314,7 @@ static VALUE
readline_s_set_completion_proc(VALUE self, VALUE proc)
{
rb_secure(4);
- if (!rb_respond_to(proc, rb_intern("call")))
+ if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))
rb_raise(rb_eArgError, "argument must respond to `call'");
return rb_ivar_set(mReadline, completion_proc, proc);
}