summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 8812524a67..e3a1dcbf02 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -204,11 +204,16 @@ readline_s_set_completion_append_character(self, str)
{
#ifdef READLINE_21_OR_LATER
rb_secure(4);
- SafeStringValue(str);
- if (NIL_P(str) || RSTRING(str)->len == 0) {
+ if (NIL_P(str)) {
rl_completion_append_character = '\0';
- } else {
- rl_completion_append_character = RSTRING(str)->ptr[0];
+ }
+ else {
+ SafeStringValue(str);
+ if (RSTRING(str)->len == 0) {
+ rl_completion_append_character = '\0';
+ } else {
+ rl_completion_append_character = RSTRING(str)->ptr[0];
+ }
}
return self;