aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-25 09:28:31 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-25 09:28:31 +0000
commit0eb5c917e06561a0ce8957702d21c93ec803216f (patch)
tree0d7c10e36e3aff4b05cf4c253f06d4060b9c530d /string.c
parentead329fd8ea6f0ecf11c6ec98e073eed6fe2810c (diff)
downloadruby-0eb5c917e06561a0ce8957702d21c93ec803216f.tar.gz
* string.c (rb_str_each_line): don't call rb_enc_codepoint with empty
string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index b06c2f5b8f..aaf14468af 100644
--- a/string.c
+++ b/string.c
@@ -4310,7 +4310,7 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str)
int n = rb_enc_codelen(c, enc);
if (rslen == 0 && c == newline) {
- while (rb_enc_codepoint(p, pend, enc) == newline) {
+ while (p < pend && rb_enc_codepoint(p, pend, enc) == newline) {
p += n;
}
p -= n;