mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-04-27 19:15:24 +00:00
fix: prevent npe by handling checking error in NewAnalysis call (#1365)
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. Signed-off-by: Danny Clark <danielclark@google.com> Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
parent
990d723909
commit
83672fa768
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user