diff options
author | Robin Jarry <robin@jarry.cc> | 2022-12-19 11:25:24 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-12-19 13:53:03 +0100 |
commit | 4d446719a815b64cd6482c338e364ff8848c8a71 (patch) | |
tree | 9e3a4df73c4bd9b964fdb46d184dc34ff33ca95e /widgets/account-wizard.go | |
parent | c6587e592d08fc47117b7448491204c775783e4b (diff) | |
download | aerc-4d446719a815b64cd6482c338e364ff8848c8a71.tar.gz |
wizard: fix panic on any key press
When using :new-account, aerc crashes when entering a letter with the
following trace:
panic: 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=0x18 pc=0x66930e]
goroutine 1 [running]:
git.sr.ht/~rjarry/aerc/log.PanicHandler()
git.sr.ht/~rjarry/aerc/log/panic-logger.go:51 +0x73e
panic({0xa2b200, 0x10204e0})
runtime/panic.go:890 +0x262
git.sr.ht/~rjarry/aerc/config.(*KeyBindings).GetBinding(0xc000370000?, {0xc000634c48?, 0xc000118900?, 0x5843da?})
git.sr.ht/~rjarry/aerc/config/binds.go:331 +0x2e
git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Event(0xc000370000, {0xbd1e60?, 0xc00112e000?})
git.sr.ht/~rjarry/aerc/widgets/aerc.go:309 +0x196
git.sr.ht/~rjarry/aerc/lib/ui.(*UI).HandleEvent(0xc00031e840, {0xbd1e60?, 0xc00112e000})
git.sr.ht/~rjarry/aerc/lib/ui/ui.go:141 +0x162
main.main()
git.sr.ht/~rjarry/aerc/aerc.go:246 +0xa89
The issue is that the keyNames map is empty when defaultBindsConfig() is
called and ParseBinding("<C-q>", ":quit<Enter>") returns an error:
Unknown key 'C-q' which is (unfortunately) ignored and nil is inserted
in the wizard bindings.
Fix that by initializing keyNames at the module level and remove init().
Fixes: c05c2ffe0424 ("config: make various sections accessible via global vars")
Reported-by: Moritz Poldrack <moritz@poldrack.dev>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'widgets/account-wizard.go')
0 files changed, 0 insertions, 0 deletions