From 25f6624e6872a6aab31c645d4c22bbd32f93a499 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 7 Jul 2015 23:46:58 +0200 Subject: [PATCH] Handle empty list error --- src/Main.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index 25b0704..c1a8fc6 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -90,7 +90,10 @@ search ProgArgs {..} = do let res = if null exactMatches then select (fuzzy searchTerm items) else select (byAttrib (Left exactMatches, Str searchTerm) items) - if contentOnly - then mapM_ putStrLn (map content res) - else pprint res - when (not noClipboard) (sendClipboard (content $ head res)) + if null res + then putStrLn "No results found" + else do + if contentOnly + then mapM_ putStrLn (map content res) + else pprint res + when (not noClipboard) (sendClipboard (content $ head res))