avoid trying to find minimum element of empty map

This commit is contained in:
Joey Hess 2014-01-18 11:38:01 -04:00
parent 1d3e60830d
commit 099c650292

View file

@ -338,7 +338,9 @@ withUnusedMaps a params = do
unusedSpec :: UnusedMap -> String -> [Int]
unusedSpec m spec
| spec == "all" = [fst (M.findMin m)..fst (M.findMax m)]
| spec == "all" = if M.null m
then []
else [fst (M.findMin m)..fst (M.findMax m)]
| "-" `isInfixOf` spec = range $ separate (== '-') spec
| otherwise = maybe badspec (: []) (readish spec)
where