Skip to content

Commit 37f0764

Browse files
committed
internal/lsp: handle nil pointer exceptions in check for Go files
Fixes golang/go#42240 Change-Id: I48382613c9eb9d021a9e1dc9ca6ab6b4b1dfcf8f Reviewed-on: https://go-review.googlesource.com/c/tools/+/265763 Trust: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]> (cherry picked from commit 8cd080b) Reviewed-on: https://go-review.googlesource.com/c/tools/+/265977
1 parent 3b424a5 commit 37f0764

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/lsp/diagnostics.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ func (s *Server) handleFatalErrors(ctx context.Context, snapshot source.Snapshot
460460
// If the folder has no Go code in it, we shouldn't spam the user with a warning.
461461
var hasGo bool
462462
_ = filepath.Walk(snapshot.View().Folder().Filename(), func(path string, info os.FileInfo, err error) error {
463+
if err != nil {
464+
return err
465+
}
463466
if !strings.HasSuffix(info.Name(), ".go") {
464467
return nil
465468
}

0 commit comments

Comments
 (0)