diff options
Diffstat (limited to 'ext/-test-/string/cstr.c')
-rw-r--r-- | ext/-test-/string/cstr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c index 81edbb0b79..ba2e46bc55 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 |