@@ -642,7 +642,7 @@ bodyPartToBlocks (ListItem pPr _ _ _ parparts) =
642642 bodyPartToBlocks $ Paragraph pPr' parparts
643643bodyPartToBlocks (Tbl _ _ _ []) =
644644 return $ para mempty
645−bodyPartToBlocks (Tbl cap _ look (r:rs)) = do
645+bodyPartToBlocks (Tbl cap _ look parts@(r:rs)) = do
646646 let caption = text cap
647647 (hdr, rows) = case firstRowFormatting look of
648648 True | null rs -> (Nothing, [r])
@@ -651,10 +651,14 @@ bodyPartToBlocks (Tbl cap _ look (r:rs)) = do
651651
652652 cells <- mapM rowToBlocksList rows
653653
654− let width = case cells of
655− r':_ -> length r'
656− -- shouldn't happen
657− [] -> 0
654+ let width = maybe 0 maximum $ nonEmpty $ map rowLength parts
655+ -- Data.List.NonEmpty is not available with ghc 7.10 so we roll out
656+ -- our own, see
657+ -- https://github.com/jgm/pandoc/pull/4361#issuecomment-365416155
658+ nonEmpty [] = Nothing
659+ nonEmpty l = Just l
660+ rowLength :: Row -> Int
661+ rowLength (Row c) = length c
658662
659663 hdrCells <- case hdr of
660664 Just r' -> rowToBlocksList r'