From 54476d2cd180e896ddf1c8cdcacd98f46f78d7db Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 24 Jan 2023 11:50:43 -0500 Subject: [PATCH] fix verbose mode panic with tui log capture (#174) --- cmd/zrok/accessTui.go | 2 +- cmd/zrok/shareTui.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/zrok/accessTui.go b/cmd/zrok/accessTui.go index 0ce46477..17685244 100644 --- a/cmd/zrok/accessTui.go +++ b/cmd/zrok/accessTui.go @@ -181,7 +181,7 @@ func (m *accessModel) Write(p []byte) (n int, err error) { lines := strings.Split(in, "\n") for _, line := range lines { cleanLine := strings.ReplaceAll(line, "\n", "") - if cleanLine != "" { + if cleanLine != "" && m.prg != nil { m.prg.Send(accessLogLine(cleanLine)) } } diff --git a/cmd/zrok/shareTui.go b/cmd/zrok/shareTui.go index 38a43e66..42da905a 100644 --- a/cmd/zrok/shareTui.go +++ b/cmd/zrok/shareTui.go @@ -204,7 +204,7 @@ func (m *shareModel) Write(p []byte) (n int, err error) { lines := strings.Split(in, "\n") for _, line := range lines { cleanLine := strings.ReplaceAll(line, "\n", "") - if cleanLine != "" { + if cleanLine != "" && m.prg != nil { m.prg.Send(shareLogLine(cleanLine)) } }