diff options
author | Robin Jarry <robin@jarry.cc> | 2023-06-29 09:21:04 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-07-15 17:51:33 +0200 |
commit | 8dcb58c81782a30f06794227cf9a1b54928134e3 (patch) | |
tree | e11226a2a9b4d4a164879ea4755823c6ac08436a /config/config.go | |
parent | 7a674312b6f006be7c1241b10cf9063841aa1d9c (diff) | |
download | aerc-8dcb58c81782a30f06794227cf9a1b54928134e3.tar.gz |
wizard: properly initialize configuration
The wizard constructs an AccountConfig object by hand without
initializing default values. This causes a crash when replying to an
email (rr) just after completing the account creation:
~/.config/aerc/aerc.conf not found, installing the system default~/.config/aerc/binds.conf not found, installing the system defaultpanic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x5d1550]
...
regexp.(*Regexp).doExecute(0x7fc1089aa108?, {0x0?, 0x0?}, {0x0?, 0x0?, 0xc000fe5408?}, {0xc000698120?, 0x10?}, 0xad3a40?, 0x2, ...)
regexp/exec.go:527 +0x90
regexp.(*Regexp).FindString(0x44e372?, {0xc000698120, 0x27})
regexp/regexp.go:852 +0x6c
git.sr.ht/~rjarry/aerc/commands/msg.trimLocalizedRe({0xc000698120, 0x27}, 0xc00003e420?)
git.sr.ht/~rjarry/aerc/commands/msg/reply.go:332 +0x36
git.sr.ht/~rjarry/aerc/commands/msg.reply.Execute({}, 0xc0002ba180, {0xc0002f8800?, 0x2, 0x2})
git.sr.ht/~rjarry/aerc/commands/msg/reply.go:157 +0x765
...
Extract the account parsing and initialization into a function. Reuse
that function in both accounts.conf parsing and the wizard.
Fixes: 40cc540357d9 ("reply: allow to override localized Re regexp in configuration")
Reported-by: Mechiel Lukkien <mechiel@ueber.net>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Andrew Yu <andrew@andrewyu.org>
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go index d70bcfe0..4ace7d26 100644 --- a/config/config.go +++ b/config/config.go @@ -98,7 +98,7 @@ func LoadConfigFromFile(root *string, accts []string) error { // if it doesn't exist copy over the template, then load if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) { - fmt.Printf("%s not found, installing the system default", filename) + fmt.Printf("%s not found, installing the system default\n", filename) if err := installTemplate(*root, "aerc.conf"); err != nil { return err } |