projects
/
git-annex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9cfd15
)
avoid parseDuration succeeding on empty string
author
Joey Hess
<joeyh@joeyh.name>
Tue, 8 Dec 2020 16:51:56 +0000
(12:51 -0400)
committer
Joey Hess
<joeyh@joeyh.name>
Tue, 8 Dec 2020 16:51:56 +0000
(12:51 -0400)
Utility/HumanTime.hs
patch
|
blob
|
history
diff --git
a/Utility/HumanTime.hs
b/Utility/HumanTime.hs
index 7db100801585de10591239d65d982f8e6bfa80bd..5178531cf8ce2be0ab6541a4ba2a4b48398829a9 100644
(file)
--- a/
Utility/HumanTime.hs
+++ b/
Utility/HumanTime.hs
@@
-45,7
+45,9
@@
daysToDuration i = Duration $ i * dsecs
{- Parses a human-input time duration, of the form "5h", "1m", "5h1m", etc -}
parseDuration :: String -> Either String Duration
-parseDuration d = maybe parsefail (Right . Duration) $ go 0 d
+parseDuration d
+ | null d = parsefail
+ | otherwise = maybe parsefail (Right . Duration) $ go 0 d
where
go n [] = return n
go n s = do