aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-07-10 23:51:20 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-15 18:22:03 +0200
commitb08d38c1e57934fec2f244444c233a1bca58ed76 (patch)
treece430c54e2bb151e4fb5ce4262e9db40509de9ce
parent8dcb58c81782a30f06794227cf9a1b54928134e3 (diff)
downloadaerc-b08d38c1e57934fec2f244444c233a1bca58ed76.tar.gz
aerc-b08d38c1e57934fec2f244444c233a1bca58ed76.zip
commands: fix panic in helper struct
Fix a panic in the helper struct than can occur when a delayed archiving operation (from :send -a) occurs and the user is already in a different window that does not implement the ProvideMessages interface. Use the *AccountView as a fallback when the type cast fails. Fixes: https://todo.sr.ht/~rjarry/aerc/181 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
-rw-r--r--commands/msg/utils.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/commands/msg/utils.go b/commands/msg/utils.go
index 8a00a35e..8210cae1 100644
--- a/commands/msg/utils.go
+++ b/commands/msg/utils.go
@@ -16,8 +16,12 @@ type helper struct {
}
func newHelper(aerc *widgets.Aerc) *helper {
+ msgProvider, ok := aerc.SelectedTabContent().(widgets.ProvidesMessages)
+ if !ok {
+ msgProvider = aerc.SelectedAccount()
+ }
return &helper{
- msgProvider: aerc.SelectedTabContent().(widgets.ProvidesMessages),
+ msgProvider: msgProvider,
statusInfo: func(s string) {
aerc.PushStatus(s, 10*time.Second)
},