Fix nil pointer in NewSearchServer - use serverOptions.Backend

The backend may be created inside the function and assigned to
serverOptions.Backend, not opts.Backend. Using opts.Backend caused
a nil pointer dereference in searchSupport.buildIndexes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mayor
2026-01-14 16:22:42 +01:00
committed by Rafael Paulovic
co-authored by Claude Opus 4.5
parent 4913baaf04
commit 785cc739ee
+1 -1
View File
@@ -159,7 +159,7 @@ func NewResourceServer(opts ServerOptions) (resource.ResourceServer, resource.Se
}
}
search, err := resource.NewSearchServer(opts.SearchOptions, opts.Backend, opts.AccessClient, nil, opts.IndexMetrics, opts.OwnsIndexFn)
search, err := resource.NewSearchServer(opts.SearchOptions, serverOptions.Backend, opts.AccessClient, nil, opts.IndexMetrics, opts.OwnsIndexFn)
if err != nil {
return nil, nil, fmt.Errorf("failed to initialize search: %w", err)
}