diff options
author | Robin Jarry <robin@jarry.cc> | 2023-10-11 08:45:18 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-10-11 10:21:50 +0200 |
commit | 34650131379a4542538da63751a89588d2f2cc85 (patch) | |
tree | c90b08d51d6018637d1d71359bc5b9f15f2db42d /app/terminal.go | |
parent | bc176bd61ba726351a489cabf4da16a47dc5ec3b (diff) | |
download | aerc-34650131379a4542538da63751a89588d2f2cc85.tar.gz |
app: fix nil pointer dereference on startup
Fix the following crash on startup:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x9e2314]
goroutine 1 [running]:
git.sr.ht/~rjarry/aerc/log.PanicHandler()
git.sr.ht/~rjarry/aerc/log/panic-logger.go:51 +0x70f
panic({0xae95a0, 0x119f9b0})
runtime/panic.go:890 +0x263
git.sr.ht/~rjarry/aerc/app.(*Aerc).SelectedAccount(0x8503cdd28?)
git.sr.ht/~rjarry/aerc/app/aerc.go:384 +0x14
git.sr.ht/~rjarry/aerc/app.SelectedAccount(...)
git.sr.ht/~rjarry/aerc/app/app.go:44
git.sr.ht/~rjarry/aerc/app.(*AccountView).isSelected(...)
git.sr.ht/~rjarry/aerc/app/account.go:225
git.sr.ht/~rjarry/aerc/app.(*AccountView).UpdateStatus(0x850364380)
git.sr.ht/~rjarry/aerc/app/account.go:127 +0x28
git.sr.ht/~rjarry/aerc/app.(*AccountView).SetStatus(0x850364380, {0x850243a50, 0x1,
0x0?})
git.sr.ht/~rjarry/aerc/app/account.go:123 +0x94
git.sr.ht/~rjarry/aerc/app.NewAccountView(0x8503d38c0, 0x85041bf80)
git.sr.ht/~rjarry/aerc/app/account.go:111 +0x573
git.sr.ht/~rjarry/aerc/app.NewAerc({0xcab0c0?, 0x11fa3c8}, 0x850433860, 0xbf3040, {0xca75e8?, 0x11ca800}, 0x0?)
git.sr.ht/~rjarry/aerc/app/aerc.go:91 +0x6ce
git.sr.ht/~rjarry/aerc/app.Init(...)
git.sr.ht/~rjarry/aerc/app/app.go:24
main.main()
git.sr.ht/~rjarry/aerc/main.go:242 +0x52e
There was two things very wrong:
- Access of the global aerc pointer before it was initialized.
- The host field of AccountView was left there and still accessed but
never initialized.
Replace the global aerc pointer with a real struct value. Update code
accordingly.
Remove the AccountView.host field which is now useless.
Reported-by: Jens Grassel <jens@wegtam.com>
Reported-by: Matěj Cepl <mcepl@cepl.eu>
Fixes: bc176bd61ba7 ("app: export global functions")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'app/terminal.go')
0 files changed, 0 insertions, 0 deletions