diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-23 14:33:39 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-23 14:33:49 +0100 |
commit | dd1ac8f48fdb4cf29c924690ecbed4557519b444 (patch) | |
tree | c6d5e3fa56da9a9d973aa6b1ad8461a5bb0b4df2 /src | |
parent | 86142ab7c01c2dbb37129fdf3abe51572cfa5c92 (diff) | |
download | pandoc-dd1ac8f48fdb4cf29c924690ecbed4557519b444.tar.gz |
Writers.Shared.gridTable: defensive coding around 'maximum'.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Shared.hs | 3 |
1 files changed, 2 insertions, 1 deletions
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 |