protect against another nil

This commit is contained in:
Jeff Carr 2025-02-13 22:24:34 -06:00
parent 1f33979af9
commit 5a9f3565aa
1 changed files with 5 additions and 0 deletions

View File

@ -166,6 +166,11 @@ func (w stdout) Write(p []byte) (n int, err error) {
}
func (w *guiWidget) Write(p []byte) (n int, err error) {
if w == nil {
lines := strings.Split(strings.TrimSpace(string(p)), "\n")
me.stdout.outputS = append(me.stdout.outputS, lines...)
return len(p), nil
}
w.tainted = true
me.writeMutex.Lock()
defer me.writeMutex.Unlock()