From 322715317377bd3336061d67f6172e60a7088f20 Mon Sep 17 00:00:00 2001 From: MooZ Date: Sun, 15 Mar 2020 19:47:38 +0100 Subject: [PATCH] Fixed unit test crash. --- tinypds.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tinypds.h b/tinypds.h index c4bb139..215025f 100644 --- a/tinypds.h +++ b/tinypds.h @@ -430,10 +430,12 @@ static void PDS_error(PDS_parser *parser, const char *current, int error, const parser->status = error; if(0 != parser->callbacks.error) { PDS_error_description description; - description.line_first = parser->line; - for(description.line_last = parser->line; description.line_last != parser->last; description.line_last++) { - if('\n' == *description.line_last) { - break; + description.line_first = description.line_last = parser->line; + if(description.line_last) { + for(; description.line_last != parser->last; description.line_last++) { + if('\n' == *description.line_last) { + break; + } } } description.number = parser->line_num;