From 75c7442d34aed76e9d66c431528bdf291cd21028 Mon Sep 17 00:00:00 2001 From: contact Date: Tue, 12 Oct 2021 15:36:00 +0000 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. git-svn-id: file:///srv/svn/repo/suika/trunk@628 f0ae65fe-ee39-954e-97ec-027ff2717ef4 --- 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 }