From 8710452d04805d4e0bc9181fbdccaeca173910ba Mon Sep 17 00:00:00 2001 From: Drew Smirnoff Date: Sun, 7 Jun 2026 21:00:12 +0400 Subject: [PATCH] fix: crashes when sending (#1454) ## What? Fixes crashes when sending. ## Why? Fixes #1453 Signed-off-by: drew --- daemon/daemon.go | 6 ++++++ main.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/daemon/daemon.go b/daemon/daemon.go index 231f7de7441a6916b3d8d5c0d78ce4c136e7df01..ea4e5f59ef91c0067dfacdec1a9048f637a0ae01 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -544,6 +544,12 @@ func (d *Daemon) processOutbox(ctx context.Context) { } func (d *Daemon) sendOutboxEntry(entry *OutboxEntry) { + defer func() { + if r := recover(); r != nil { + log.Printf("daemon: panic sending outbox entry %s: %v", entry.ID, r) + } + }() + acct := d.getAccount(entry.Params.AccountID) if acct == nil { log.Printf("daemon: outbox send failed, no account for %s", entry.Params.AccountID) diff --git a/main.go b/main.go index 58c9444ce4d145fed21789a80f2cd88a9713f29b..f39502d1fdd2e0bf675d117a326961d8a38d18cb 100644 --- a/main.go +++ b/main.go @@ -1725,6 +1725,11 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:gocyclo account = m.config.GetFirstAccount() } + // Ensure the service is initialized even when composing without visiting inbox. + if m.service == nil && m.config != nil { + m.service = daemonclient.NewService(m.config) + } + statusText := "Sending email..." if msg.SignPGP && account != nil && account.PGPKeySource == "yubikey" { statusText = "Touch your YubiKey to sign..."