From 8a0400c5cc17e0d8a113d1367b851dc69a3aea7d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 12 Oct 2021 17:34:22 +0200 Subject: [PATCH] msgstore_fs: fix ListTargets error on missing log dir Initially, before connecting to the network, the log dir will be empty. Return an empty list of chat history targets in this case. --- msgstore_fs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/msgstore_fs.go b/msgstore_fs.go index 20653c8..f3df2f1 100644 --- a/msgstore_fs.go +++ b/msgstore_fs.go @@ -480,7 +480,9 @@ func (ms *fsMessageStore) ListTargets(network *network, start, end time.Time, li end = end.In(time.Local) rootPath := filepath.Join(ms.root, escapeFilename(network.GetName())) root, err := os.Open(rootPath) - if err != nil { + if os.IsNotExist(err) { + return nil, nil + } else if err != nil { return nil, err }