mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (chopped_length): early return for empty strings
[Bug #11391] From: Franck Verrot <franck@verrot.fr> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f27643e5eb
commit
fb84b86be0
1 changed files with 1 additions and 1 deletions
2
string.c
2
string.c
|
@ -8547,7 +8547,7 @@ chopped_length(VALUE str)
|
|||
|
||||
beg = RSTRING_PTR(str);
|
||||
end = beg + RSTRING_LEN(str);
|
||||
if (beg > end) return 0;
|
||||
if (beg >= end) return 0;
|
||||
p = rb_enc_prev_char(beg, end, end, enc);
|
||||
if (!p) return 0;
|
||||
if (p > beg && rb_enc_ascget(p, end, 0, enc) == '\n') {
|
||||
|
|
Loading…
Reference in a new issue