summaryrefslogtreecommitdiffstats
path: root/src/erec.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-01-10 09:28:37 +0000
committerPatrick McHardy <kaber@trash.net>2014-01-10 09:28:37 +0000
commit806f8bba0a611fc0ce5b3104b929ce441f2b6f77 (patch)
tree17d698563a70e64aed7db704645c953e795eaf3d /src/erec.c
parent842e591e8fbec20578d11e407e9d327f2e974276 (diff)
erec: fix error markup for errors starting at column 0
For errors starting at column 0, we must not subtract 1 to avoid underflow. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/erec.c')
-rw-r--r--src/erec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/erec.c b/src/erec.c
index 7451d94c..a157d2fa 100644
--- a/src/erec.c
+++ b/src/erec.c
@@ -138,7 +138,8 @@ void erec_print(FILE *f, const struct error_record *erec)
end = 0;
for (l = erec->num_locations - 1; l >= 0; l--) {
loc = &erec->locations[l];
- for (i = loc->first_column - 1; i < loc->last_column; i++)
+ for (i = loc->first_column ? loc->first_column - 1 : 0;
+ i < loc->last_column; i++)
buf[i] = l ? '~' : '^';
end = max(end, loc->last_column);
}