Skip to content

Commit

Permalink
Fix nil pointer dereference in workspace capabilities check
Browse files Browse the repository at this point in the history
This will fix bufbuild#3581
  • Loading branch information
micheam committed Jan 12, 2025
1 parent c60d858 commit fe9c54a
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 fe9c54a

Please sign in to comment.