mirror of
https://github.com/golang/go
synced 2024-11-22 20:40:03 -07:00
cmd/link: make Loader.SymName not crash
Even if not presented with a valid symbol, recover gracefully, so that debug prints do not crash. Change-Id: I06bbe4bec5f90b79b4830e772a7fc3d7c919df1b Reviewed-on: https://go-review.googlesource.com/c/go/+/312036 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
199575a119
commit
59ceb985c7
@ -771,6 +771,9 @@ func (l *Loader) SymName(i Sym) string {
|
|||||||
return pp.name
|
return pp.name
|
||||||
}
|
}
|
||||||
r, li := l.toLocal(i)
|
r, li := l.toLocal(i)
|
||||||
|
if r == nil {
|
||||||
|
return "?"
|
||||||
|
}
|
||||||
name := r.Sym(li).Name(r.Reader)
|
name := r.Sym(li).Name(r.Reader)
|
||||||
if !r.NeedNameExpansion() {
|
if !r.NeedNameExpansion() {
|
||||||
return name
|
return name
|
||||||
|
Loading…
Reference in New Issue
Block a user