diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-03-19 11:55:59 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-03-19 11:55:59 -0700 |
commit | 4002c35a9184ecc1c9a6553e9ee28e283cb1fd0a (patch) | |
tree | 8d39ecdd073adba7c99dea1e0aad16c18dd1f591 /src/Text/Pandoc/Readers/DocBook.hs | |
parent | 8d5116381b20442bb3fa58dac1ef7d44db618823 (diff) | |
download | pandoc-4002c35a9184ecc1c9a6553e9ee28e283cb1fd0a.tar.gz |
Protect partial uses of maximum with NonEmpty.
Diffstat (limited to 'src/Text/Pandoc/Readers/DocBook.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/DocBook.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index d38b07864..6f5bb0ad4 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -18,6 +18,7 @@ import Data.Either (rights) import Data.Foldable (asum) import Data.Generics import Data.List (intersperse,elemIndex) +import Data.List.NonEmpty (nonEmpty) import Data.Maybe (fromMaybe,mapMaybe) import Data.Text (Text) import qualified Data.Text as T @@ -949,9 +950,8 @@ parseBlock (Elem e) = (x >= '0' && x <= '9') || x == '.') w if n > 0 then Just n else Nothing - let numrows = case bodyrows of - [] -> 0 - xs -> maximum $ map length xs + let numrows = maybe 0 maximum $ nonEmpty + $ map length bodyrows let aligns = case colspecs of [] -> replicate numrows AlignDefault cs -> map toAlignment cs |