Skip to content

Commit f23e554

Browse files
committed
Fix missing return
And align the condition with `enc_find_basename` to remove the code path that `*baselen` potentially can be unset in that function.
1 parent 8f9aade commit f23e554

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5037,8 +5037,8 @@ rb_file_s_basename(int argc, VALUE *argv, VALUE _)
50375037
}
50385038

50395039
n = RSTRING_LEN(fname);
5040-
if (n == 0 || !*name) {
5041-
rb_enc_str_new(0, 0, enc);
5040+
if (n <= 0 || !*name) {
5041+
return rb_enc_str_new(0, 0, enc);
50425042
}
50435043

50445044
bool mb_enc = !rb_str_encindex_fastpath(rb_enc_to_index(enc));

0 commit comments

Comments
 (0)