From be171182259f62743d916fdf439d1fd87ccfc2c0 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 25 Dec 2007 09:28:31 +0000 Subject: * string.c (rb_str_each_line): don't call rb_enc_codepoint with empty string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index b06c2f5b8..aaf14468a 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; -- cgit