1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

go/analysis/passes/printf: handle a potential nil pointer

Fixes golang/go#33911

Change-Id: I9351bb6d9e040b39e4ade10846da5d59b93c3087
Reviewed-on: https://go-review.googlesource.com/c/tools/+/192258
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Rebecca Stambler 2019-08-28 23:32:52 -04:00
parent f4d8977246
commit bce6695301

View File

@ -117,7 +117,11 @@ func maybePrintfWrapper(info *types.Info, decl ast.Decl) *printfWrapper {
if !ok || fdecl.Body == nil {
return nil
}
fn := info.Defs[fdecl.Name].(*types.Func)
fn, ok := info.Defs[fdecl.Name].(*types.Func)
// Type information may be incomplete.
if !ok {
return nil
}
sig := fn.Type().(*types.Signature)
if !sig.Variadic() {