~sircmpwn/aerc

Fix crash if there is no to address for %F v2 PROPOSED

Thorben Günther: 1
 Fix crash if there is no to address for %F

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/9115/mbox | git am -3
Learn more about email & git

[PATCH v2] Fix crash if there is no to address for %F Export this patch

---
As discussed with bookworm in IRC this should be a more sane approach
since it doesn't spawn an error message.

 lib/format/format.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/format/format.go b/lib/format/format.go
index a070bc9..53d93aa 100644
--- a/lib/format/format.go
+++ b/lib/format/format.go
@@ -125,7 +125,7 @@ func ParseMessageFormat(
 			addr := msg.Envelope.From[0]
 			var val string
 
-			if addr.Name == accountFromAddress.Name {
+			if addr.Name == accountFromAddress.Name && len(msg.Envelope.To) != 0 {
 				addr = msg.Envelope.To[0]
 			}
 
-- 
2.24.0
Thanks!

To git.sr.ht:~sircmpwn/aerc
   06f81e8..c1d5797  master -> master
View this thread in the archives