@@ 389,14 389,15 @@ func ElectionWaitTUI(kill <-chan error, client *mautrix.Client, el *election.Ele
frame := tview.NewFrame(votersTextView)
frame.SetTitle(el.Title).SetBorder(true)
app := newTallyardApplication(kill)
- defer func() {
+ handlePanic := func() {
if r := recover(); r != nil {
if app.alive {
app.Stop()
}
log.Panicf("ElectionWaitTUI panicked! panic=%s\n%s", r, debug.Stack())
}
- }()
+ }
+ defer handlePanic()
el.RLock()
if el.LocalVoter != nil && el.CreateEvt.Sender == el.LocalVoter.JoinEvt.Sender {
@@ 431,6 432,7 @@ func ElectionWaitTUI(kill <-chan error, client *mautrix.Client, el *election.Ele
votersTextView.SetText(text)
}
go func() {
+ defer handlePanic()
var electionStarted bool
for app.alive {
el.RLock()