From dd1ac8f48fdb4cf29c924690ecbed4557519b444 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 23 Mar 2017 14:33:39 +0100 Subject: Writers.Shared.gridTable: defensive coding around 'maximum'. --- src/Text/Pandoc/Writers/Shared.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs index 3b28c58c8..299c6faaf 100644 --- a/src/Text/Pandoc/Writers/Shared.hs +++ b/src/Text/Pandoc/Writers/Shared.hs @@ -246,7 +246,8 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do let handleZeroWidths = do rawHeaders' <- mapM (blocksToDoc opts) headers rawRows' <- mapM (mapM (blocksToDoc opts)) rows - let numChars = maximum . map offset + let numChars [] = 0 + numChars xs = maximum . map offset $ xs let widthsInChars' = map ((+2) . numChars) $ transpose (rawHeaders' : rawRows') if sum widthsInChars' > writerColumns opts -- cgit v1.2.3