Skip to content

Commit

Permalink
Fix nil pointer dereference in workspace capabilities check (#3582)
Browse files Browse the repository at this point in the history
  • Loading branch information
micheam authored Jan 14, 2025
1 parent 67b1b5e commit c3dbfd7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion private/buf/buflsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ 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 {
return nil
}
didChangeConfiguration := workspaceCapabilities.DidChangeConfiguration
if didChangeConfiguration != nil && didChangeConfiguration.DynamicRegistration {
// The error is logged for us by the client wrapper.
_ = s.client.RegisterCapability(ctx, &protocol.RegistrationParams{
Registrations: []protocol.Registration{
Expand Down

0 comments on commit c3dbfd7

Please sign in to comment.