summaryrefslogtreecommitdiff
path: root/ext/stringio/stringio.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r--ext/stringio/stringio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index b9c7eb7f80..db243c4e7e 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -835,7 +835,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
str = tmp;
}
}
- else {
+ else if (!NIL_P(str)) {
StringValue(str);
}
}
@@ -862,7 +862,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
s = p;
while ((p = memchr(p, '\n', e - p)) && (p != e)) {
if (*++p == '\n') {
- e = p;
+ e = p + 1;
break;
}
}