summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stream.c b/stream.c
index 2d6e1b0b..7d35e7e1 100644
--- a/stream.c
+++ b/stream.c
@@ -1292,8 +1292,9 @@ static val string_in_get_char(val stream)
struct string_in *s = coerce(struct string_in *, stream->co.handle);
if (length_str_gt(s->string, s->pos)) {
- set(mkloc(s->pos, stream), plus(s->pos, one));
- return chr_str(s->string, s->pos);
+ val pos = s->pos;
+ set(mkloc(s->pos, stream), plus(pos, one));
+ return chr_str(s->string, pos);
}
return nil;