diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-06-07 10:59:05 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-06-07 18:01:25 +0200 |
commit | 115447e57f015b1805d2d58d1ae46beaff2299e5 (patch) | |
tree | f04d7ab4fa349a36a9fab699aefa51775e3a9b11 /widgets/account.go | |
parent | 2027223ab302f803952c486ec40f1e859638a273 (diff) | |
download | aerc-115447e57f015b1805d2d58d1ae46beaff2299e5.tar.gz |
dirlist: fix panic when disconnecting with dirlist-tree=false
Commit 2027223a created a panic when attempting to clear the dirlist
when the config option dirlist-tree is set to false.
This patch fixes that panic by creating a dirlist.ClearList() function
to prevent needing to check a callback.
Tested with both dirlist-tree=false and true
Fixes: 2027223ab302 ("fix: clear dirlist on disconnect")
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/widgets/account.go b/widgets/account.go index 93403709..7c180049 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -246,7 +246,6 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { case *types.Connect, *types.Reconnect: acct.SetStatus(statusline.ConnectionActivity("Listing mailboxes...")) acct.logger.Println("Listing mailboxes...") - acct.dirlist.SetConnected(true) acct.dirlist.UpdateList(func(dirs []string) { var dir string for _, _dir := range dirs { @@ -267,8 +266,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.newConn = true }) case *types.Disconnect: - acct.dirlist.SetConnected(false) - acct.dirlist.UpdateList(nil) + acct.dirlist.ClearList() acct.msglist.SetStore(nil) acct.logger.Println("Disconnected.") acct.SetStatus(statusline.SetConnected(false)) |