From aa808055f04951e4d6f580764ca755c4391c96b1 Mon Sep 17 00:00:00 2001 From: mpickering Date: Thu, 21 Aug 2014 17:11:21 +0100 Subject: Txt2Tags Reader: Fixed crash when reading from stdin --- src/Text/Pandoc/Readers/Txt2Tags.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs index c3a46a7f9..6f8c19ac7 100644 --- a/src/Text/Pandoc/Readers/Txt2Tags.hs +++ b/src/Text/Pandoc/Readers/Txt2Tags.hs @@ -75,9 +75,11 @@ getT2TMeta inps out = do curDate <- formatTime defaultTimeLocale "%F" <$> getZonedTime let getModTime = fmap (formatTime defaultTimeLocale "%T") . getModificationTime - curMtime <- catchIOError - (maximum <$> mapM getModTime inps) - (const (return "")) + curMtime <- case inps of + [] -> formatTime defaultTimeLocale "%T" <$> getZonedTime + _ -> catchIOError + (maximum <$> mapM getModTime inps) + (const (return "")) return $ T2TMeta curDate curMtime (intercalate ", " inps) out -- | Read Txt2Tags from an input string returning a Pandoc document -- cgit v1.2.3