Skip to content

Commit

Permalink
fix: prevent npe by handling checking error in NewAnalysis call
Browse files Browse the repository at this point in the history
If there is an issue in creating the Analysis config when calling
analysis.NewAnalysis, then we want to check before assigning the context to a
potentially nil pointer.
  • Loading branch information
pintohutch committed Jan 23, 2025
1 parent c506a4b commit 42758ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/server/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ func (h *Handler) Analyze(ctx context.Context, i *schemav1.AnalyzeRequest) (
[]string{}, //TODO: add custom http headers in server mode
false, // with stats disable
)
config.Context = ctx // Replace context for correct timeouts.
if err != nil {
return &schemav1.AnalyzeResponse{}, err
}
config.Context = ctx // Replace context for correct timeouts.
defer config.Close()

if config.CustomAnalyzersAreAvailable() {
Expand Down

0 comments on commit 42758ff

Please sign in to comment.