diff --git a/src/cmd/compile/internal/base/print.go b/src/cmd/compile/internal/base/print.go index 6831b3ada31..ac7333ca4e0 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 }