]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: do not die in early base.FlushErrors
authorRuss Cox <rsc@golang.org>
Wed, 23 Dec 2020 04:46:07 +0000 (23:46 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 23 Dec 2020 05:03:59 +0000 (05:03 +0000)
Change-Id: I72bac8a85db14494298059f8efddc5cbbf45f7ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/279214
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/base/print.go

index 6831b3ada314f10070a4c2c8259bedc024d54434..ac7333ca4e093b9e0fe6a01931c05cc850a08eca 100644 (file)
@@ -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
        }