summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/string/cstr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c
index 81edbb0b79c..ba2e46bc558 100644
--- a/ext/-test-/string/cstr.c
+++ b/ext/-test-/string/cstr.c
@@ -36,8 +36,9 @@ bug_str_cstr_term_char(VALUE str)
}
else {
c = rb_enc_mbc_to_codepoint(s, s + len, enc);
+ if (!c) return Qnil;
}
- return c ? rb_enc_uint_chr((unsigned int)c, enc) : Qnil;
+ return rb_enc_uint_chr((unsigned int)c, enc);
}
static VALUE