Skip to content

Commit

Permalink
fix: nil deref on release terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Jun 24, 2024
1 parent 42a7dd8 commit 60a57ea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,18 @@ func (p *Program) shutdown(kill bool) {
// reader. You can return control to the Program with RestoreTerminal.
func (p *Program) ReleaseTerminal() error {
atomic.StoreUint32(&p.ignoreSignals, 1)
p.cancelReader.Cancel()
if p.cancelReader != nil {
p.cancelReader.Cancel()
}

p.waitForReadLoop()

if p.renderer != nil {
p.renderer.stop()
p.altScreenWasActive = p.renderer.altScreen()
p.bpWasActive = p.renderer.bracketedPasteActive()
}

p.altScreenWasActive = p.renderer.altScreen()
p.bpWasActive = p.renderer.bracketedPasteActive()
return p.restoreTerminalState()
}

Expand Down

0 comments on commit 60a57ea

Please sign in to comment.