aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
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 8515773a84..fd17355346 100644
--- a/string.c
+++ b/string.c
@@ -7409,7 +7409,7 @@ chomp_newline(const char *p, const char *e, rb_encoding *enc)
if (rb_enc_is_newline(prev, e, enc)) {
e = prev;
prev = rb_enc_prev_char(p, e, e, enc);
- if (rb_enc_ascget(prev, e, NULL, enc) == '\r')
+ if (prev && rb_enc_ascget(prev, e, NULL, enc) == '\r')
e = prev;
}
return e;