From 69cf39089f3e5e6e5356c90c1bd8f30f76658bd0 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 22 Dec 2020 23:46:07 -0500 Subject: [PATCH] [dev.regabi] cmd/compile: do not die in early base.FlushErrors Change-Id: I72bac8a85db14494298059f8efddc5cbbf45f7ca Reviewed-on: https://go-review.googlesource.com/c/go/+/279214 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/base/print.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/base/print.go b/src/cmd/compile/internal/base/print.go index 6831b3ada3..ac7333ca4e 100644 --- a/src/cmd/compile/internal/base/print.go +++ b/src/cmd/compile/internal/base/print.go @@ -73,7 +73,9 @@ func (x byPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } // FlushErrors sorts errors seen so far by line number, prints them to stdout, // and empties the errors array. func FlushErrors() { - Ctxt.Bso.Flush() + if Ctxt != nil && Ctxt.Bso != nil { + Ctxt.Bso.Flush() + } if len(errorMsgs) == 0 { return } -- 2.50.0