From b616fbeecaf5a299a17f2616bb4c284c552385f3 Mon Sep 17 00:00:00 2001 From: Michito Maeda Date: Sun, 12 Jan 2025 23:17:14 +0900 Subject: [PATCH] Fix nil pointer dereference in workspace capabilities check This will fix bufbuild/buf#3581 --- private/buf/buflsp/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/private/buf/buflsp/server.go b/private/buf/buflsp/server.go index a9e22e696e..6af25bbf84 100644 --- a/private/buf/buflsp/server.go +++ b/private/buf/buflsp/server.go @@ -142,7 +142,8 @@ func (s *server) Initialized( ctx context.Context, params *protocol.InitializedParams, ) error { - if s.initParams.Load().Capabilities.Workspace.DidChangeConfiguration.DynamicRegistration { + workspaceCapabilities := s.initParams.Load().Capabilities.Workspace + if workspaceCapabilities != nil && workspaceCapabilities.DidChangeConfiguration.DynamicRegistration { // The error is logged for us by the client wrapper. _ = s.client.RegisterCapability(ctx, &protocol.RegistrationParams{ Registrations: []protocol.Registration{