Skip to content

Commit 8710452

Browse files
authored
fix: crashes when sending (#1454)
## What? Fixes crashes when sending. ## Why? Fixes #1453 Signed-off-by: drew <me@andrinoff.com>
1 parent 5c8bfb7 commit 8710452

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

daemon/daemon.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ func (d *Daemon) processOutbox(ctx context.Context) {
544544
}
545545

546546
func (d *Daemon) sendOutboxEntry(entry *OutboxEntry) {
547+
defer func() {
548+
if r := recover(); r != nil {
549+
log.Printf("daemon: panic sending outbox entry %s: %v", entry.ID, r)
550+
}
551+
}()
552+
547553
acct := d.getAccount(entry.Params.AccountID)
548554
if acct == nil {
549555
log.Printf("daemon: outbox send failed, no account for %s", entry.Params.AccountID)

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,11 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:gocyclo
17251725
account = m.config.GetFirstAccount()
17261726
}
17271727

1728+
// Ensure the service is initialized even when composing without visiting inbox.
1729+
if m.service == nil && m.config != nil {
1730+
m.service = daemonclient.NewService(m.config)
1731+
}
1732+
17281733
statusText := "Sending email..."
17291734
if msg.SignPGP && account != nil && account.PGPKeySource == "yubikey" {
17301735
statusText = "Touch your YubiKey to sign..."

0 commit comments

Comments
 (0)