aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-23 14:33:39 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-23 14:33:49 +0100
commitdd1ac8f48fdb4cf29c924690ecbed4557519b444 (patch)
treec6d5e3fa56da9a9d973aa6b1ad8461a5bb0b4df2 /src
parent86142ab7c01c2dbb37129fdf3abe51572cfa5c92 (diff)
downloadpandoc-dd1ac8f48fdb4cf29c924690ecbed4557519b444.tar.gz
Writers.Shared.gridTable: defensive coding around 'maximum'.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs3
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