mirror of
https://github.com/golang/go
synced 2024-11-18 08:44:43 -07:00
internal/lsp/source: handle nil pointer in newBuiltinSignature
Fixes golang/go#40230 Change-Id: I457dd3ef009c9df9293f66871acdd90dcc6e1dcc Reviewed-on: https://go-review.googlesource.com/c/tools/+/242798 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
9048b464a0
commit
b42590c1b1
@ -79,7 +79,11 @@ func newBuiltinSignature(ctx context.Context, view View, name string) (*signatur
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
decl, ok := builtin.Package().Scope.Lookup(name).Decl.(*ast.FuncDecl)
|
||||
obj := builtin.Package().Scope.Lookup(name)
|
||||
if obj == nil {
|
||||
return nil, fmt.Errorf("no builtin object for %s", name)
|
||||
}
|
||||
decl, ok := obj.Decl.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no function declaration for builtin: %s", name)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user