internal/lsp: add check for nil package
Fixes golang/go#31604 Change-Id: I60ec000d505c64783e5f51f62d168dc31c2fbe19 Reviewed-on: https://go-review.googlesource.com/c/tools/+/172968 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
1e2181f3f4
commit
3ff669b183
|
@ -54,6 +54,9 @@ func Identifier(ctx context.Context, v View, f File, pos token.Pos) (*Identifier
|
|||
func identifier(ctx context.Context, v View, f File, pos token.Pos) (*IdentifierInfo, error) {
|
||||
fAST := f.GetAST(ctx)
|
||||
pkg := f.GetPackage(ctx)
|
||||
if pkg == nil {
|
||||
return nil, fmt.Errorf("no package for %s", f.URI())
|
||||
}
|
||||
if pkg.IsIllTyped() {
|
||||
return nil, fmt.Errorf("package for %s is ill typed", f.URI())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue