diff --git a/hledger/Hledger/Cli/Commands/Run.hs b/hledger/Hledger/Cli/Commands/Run.hs index 63842ee8b..000f4f772 100644 --- a/hledger/Hledger/Cli/Commands/Run.hs +++ b/hledger/Hledger/Cli/Commands/Run.hs @@ -137,7 +137,9 @@ defaultJournalKey = "journal specified in args of run" addJournalToCache :: Journal -> String -> IO () addJournalToCache j key = modifyMVar_ journalCache $ \cache -> - return $ Map.insert key j cache + case Map.lookup key cache of + Just _ -> return cache + Nothing -> return $ Map.insert key j cache withJournalCached :: CliOpts -> (Journal -> IO ()) -> IO () withJournalCached cliopts cmd = do