summaryrefslogtreecommitdiff
path: root/Command/Unused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-18 11:38:01 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-18 11:38:01 -0400
commitbe6b3d8ee966f58bbcc765401b6d9a09e71e7946 (patch)
tree02a0907445192b2e7434c0f13c3a5f95f7284624 /Command/Unused.hs
parent561db6fff3cea081f3203bddee079f5c689ba26e (diff)
avoid trying to find minimum element of empty map
Diffstat (limited to 'Command/Unused.hs')
-rw-r--r--Command/Unused.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 1e5cdc163..f99528cfa 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -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