From 6f0482744cab9ab0f859f77e8969589e5158f807 Mon Sep 17 00:00:00 2001 From: Edward Muller Date: Fri, 14 Jun 2019 20:22:20 +0000 Subject: [PATCH] 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 Reviewed-by: Rebecca Stambler --- internal/lsp/cache/check.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/lsp/cache/check.go b/internal/lsp/cache/check.go index 38b3632a4d..32bd381658 100644 --- a/internal/lsp/cache/check.go +++ b/internal/lsp/cache/check.go @@ -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() {