Skip to content

BlobSet constructor defensive against nil#2093

Merged
unmultimedio merged 1 commit intomainfrom
jfigueroa/defensive-blob-set-constructor
May 16, 2023
Merged

BlobSet constructor defensive against nil#2093
unmultimedio merged 1 commit intomainfrom
jfigueroa/defensive-blob-set-constructor

Conversation

@unmultimedio
Copy link
Member

@unmultimedio unmultimedio commented May 16, 2023

Reject nil blobs to avoid panics. Also a new option in the blob set constructor to allow skipping them instead of failing.

@unmultimedio unmultimedio requested a review from pkwarren May 16, 2023 16:02
@unmultimedio unmultimedio self-assigned this May 16, 2023
}
return nil, fmt.Errorf("blobs[%d]: nil blob", i)
}
digestStr := b.Digest().String()
Copy link
Member Author

Choose a reason for hiding this comment

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

nil-checking saves us from panicking in this line.

@unmultimedio unmultimedio merged commit 09f612d into main May 16, 2023
@unmultimedio unmultimedio deleted the jfigueroa/defensive-blob-set-constructor branch May 16, 2023 16:22
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