Skip to content

Commit

Permalink
internal/lsp/source: handle nil pointer in newBuiltinSignature
Browse files Browse the repository at this point in the history
Fixes golang/go#40230

Change-Id: I457dd3ef009c9df9293f66871acdd90dcc6e1dcc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/242798
Run-TryBot: Rebecca Stambler <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
  • Loading branch information
stamblerre committed Jul 15, 2020
1 parent 9048b46 commit b42590c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/lsp/source/types_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit b42590c

Please sign in to comment.