From 2d081dbd584edb37a01ef482b03a9dc98817c47a Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 14 May 2019 10:22:10 -0400 Subject: [PATCH] internal/lsp: fix nil pointer when propagating diagnostics Fixes golang/go#32030 Change-Id: I5ae7f2dc68c68c1a4851c637dcb75f312b0b35f5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/177057 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Ian Cottrell --- internal/lsp/source/diagnostics.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/lsp/source/diagnostics.go b/internal/lsp/source/diagnostics.go index 4b3b94ccdf..032c4afffa 100644 --- a/internal/lsp/source/diagnostics.go +++ b/internal/lsp/source/diagnostics.go @@ -74,6 +74,9 @@ func Diagnostics(ctx context.Context, v View, uri span.URI) (map[span.URI][]Diag // Updates to the diagnostics for this package may need to be propagated. for _, f := range f.GetActiveReverseDeps(ctx) { pkg := f.GetPackage(ctx) + if pkg == nil { + continue + } for _, filename := range pkg.GetFilenames() { reports[span.FileURI(filename)] = []Diagnostic{} }