summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-02-09 21:32:28 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2021-02-09 21:32:28 +0100
commit214aa9142556cbee2cea214d395a7cf9a2c86c4b (patch)
tree3c3e393c7c13964c12bba65011748c478f7990ca /src
parent0ef31d05e00696d08adaf3ff4d5300424f88bdc1 (diff)
Properly handle empty history listing
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 6fc27b7..4bb2f14 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -258,10 +258,13 @@ cmdHistory = void $ do
PeerIdentityFull pid <- peerIdentity peer
let powner = finalOwner pid
- Just thread <- return $ find (sameIdentity powner . msgPeer) $
- messageThreadView $ lookupSharedValue $ lsShared $ headObject ehead
- tzone <- liftIO $ getCurrentTimeZone
- liftIO $ mapM_ (putStrLn . formatMessage tzone) $ reverse $ take 50 $ threadToList thread
+ case find (sameIdentity powner . msgPeer) $
+ messageThreadView $ lookupSharedValue $ lsShared $ headObject ehead of
+ Just thread -> do
+ tzone <- liftIO $ getCurrentTimeZone
+ liftIO $ mapM_ (putStrLn . formatMessage tzone) $ reverse $ take 50 $ threadToList thread
+ Nothing -> do
+ liftIO $ putStrLn $ "<empty history>"
cmdUpdateIdentity :: Command
cmdUpdateIdentity = void $ do