From 7481775fcd88942364dcb99e16bde9ead716ea6d Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 4 Dec 2020 17:13:33 +0100 Subject: [PATCH] Application can be stopped in suspended mode. Fixes #499 --- application.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application.go b/application.go index 92e8afe..19aeeeb 100644 --- a/application.go +++ b/application.go @@ -514,6 +514,14 @@ func (a *Application) Suspend(f func()) bool { // Wait for "f" to return. f() + // If stop was called in the meantime (a.screen is nil), we're done already. + a.RLock() + screen = a.screen + a.RUnlock() + if screen == nil { + return true + } + // Make a new screen. var err error screen, err = tcell.NewScreen()