From 09a267a5b230f3d42aacb00188c3c168bbc4e42a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 4 Aug 2015 20:28:06 -0700 Subject: * stream.c (inc_indent): If a negative indentation increment goes below zero, clamp it at zero. (set_indent): Clamp indentation value to zero. --- stream.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'stream.c') diff --git a/stream.c b/stream.c index a44db8db..7d425d38 100644 --- a/stream.c +++ b/stream.c @@ -2686,6 +2686,8 @@ val set_indent(val stream, val indent) cobj_handle(stream, stream_s)); val oldval = num(s->indent_chars); s->indent_chars = c_num(indent); + if (s->indent_chars < 0) + s->indent_chars = 0; return oldval; } @@ -2696,6 +2698,8 @@ val inc_indent(val stream, val delta) val oldval = num(s->indent_chars); val col = num(s->column); s->indent_chars = c_num(plus(delta, col)); + if (s->indent_chars < 0) + s->indent_chars = 0; return oldval; } -- cgit v1.2.3