1
0
mirror of https://github.com/golang/go synced 2024-09-30 20:28:32 -06:00

internal/lsp/cache: fix nil check by adding missing "continue"

Without this accessing gof.ast.file.Pos() will panic if gof.ast.file is nil

Change-Id: I829f3667d201f026fcf0475f4fdabce0aced58f8

Change-Id: I829f3667d201f026fcf0475f4fdabce0aced58f8
GitHub-Last-Rev: 777c015d691bf0d14cab5bb0bca6749cc9bdf605
GitHub-Pull-Request: golang/tools#119
Reviewed-on: https://go-review.googlesource.com/c/tools/+/182420
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Edward Muller 2019-06-14 20:22:20 +00:00 committed by Rebecca Stambler
parent 9a3b5d688f
commit 6f0482744c

View File

@ -178,6 +178,7 @@ func (imp *importer) cachePackage(ctx context.Context, pkg *pkg, meta *metadata)
}
if gof.ast.file == nil {
imp.view.session.log.Errorf(ctx, "no AST for %s", filename)
continue
}
pos := gof.ast.file.Pos()
if !pos.IsValid() {