diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2021-02-09 21:32:28 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2021-02-09 21:32:28 +0100 |
commit | 214aa9142556cbee2cea214d395a7cf9a2c86c4b (patch) | |
tree | 3c3e393c7c13964c12bba65011748c478f7990ca /src/Main.hs | |
parent | 0ef31d05e00696d08adaf3ff4d5300424f88bdc1 (diff) |
Properly handle empty history listing
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 11 |
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 |