From 8f5708d9be34d350e03216f8875306a11b2a4efa Mon Sep 17 00:00:00 2001 From: xackery Date: Tue, 19 Dec 2023 06:28:37 -0800 Subject: [PATCH] Add nil check --- peqeditorsql/tail.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/peqeditorsql/tail.go b/peqeditorsql/tail.go index edb01e1..b560926 100644 --- a/peqeditorsql/tail.go +++ b/peqeditorsql/tail.go @@ -47,7 +47,9 @@ func newTailWatch(rootCtx context.Context, req *tailReq, msgChan chan string) (* func (e *tailWatch) restart(msgChan chan string) error { var err error - e.cancel() + if e.cancel != nil { + e.cancel() + } time.Sleep(1 * time.Second) e.ctx, e.cancel = context.WithCancel(context.Background()) buf := new(bytes.Buffer)