Skip to content

compare: check segments #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged

Conversation

klauspost
Copy link
Collaborator

Fixes crash mentioned on #389

Fixes crash mentioned on minio#389
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a crash by ensuring that the nil check for the "Segmented" field is more comprehensive before accessing its "Segments" member.

  • Added nil checks for both the "Segmented" field and its "Segments" member in both the "before" and "after" objects.
  • Updates the condition in pkg/aggregate/compare.go to prevent potential crashes when "Segmented" is nil.
Comments suppressed due to low confidence (1)

pkg/aggregate/compare.go:35

  • The error message accesses 'Segments' on 'before.Throughput.Segmented' and 'after.Throughput.Segmented' without checking if these fields are nil. This may lead to a nil pointer dereference when formatting the error message. Consider modifying the error message to safely handle nil 'Segmented' values without directly accessing their 'Segments' field.
return nil, fmt.Errorf("no segments found in benchmark run. before: %v, after %v", before.Throughput.Segmented.Segments, after.Throughput.Segmented.Segments)

@harshavardhana harshavardhana merged commit c29f421 into minio:master Apr 28, 2025
6 checks passed
@klauspost klauspost deleted the check-segments branch April 28, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants