From 191186556e8df468bec99ae47cd09817e9d288a0 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 14 Oct 2014 18:18:05 +0000 Subject: even if a table has zero columns, do not segfault in the formatter; bug reported by bentley@ --- out.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'out.c') diff --git a/out.c b/out.c index 93cc9658..5b08a09a 100644 --- a/out.c +++ b/out.c @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.52 2014/10/14 02:16:06 schwarze Exp $ */ +/* $Id: out.c,v 1.53 2014/10/14 18:18:05 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2014 Ingo Schwarze @@ -158,7 +158,7 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp, tbl->cols = mandoc_calloc((size_t)sp->opts->cols, sizeof(struct roffcol)); - for (maxcol = 0; sp; sp = sp->next) { + for (maxcol = -1; sp; sp = sp->next) { if (TBL_SPAN_DATA != sp->pos) continue; spans = 1; -- cgit v1.2.3