Skip to content

fix: handle nil zeroer pointers in Option.IsZero - #126

Open
yuefdev wants to merge 1 commit into
samber:masterfrom
yuefdev:fix/option-nil-zeroer-sol
Open

yuefdev wants to merge 1 commit into
samber:masterfrom
yuefdev:fix/option-nil-zeroer-sol

Conversation

@yuefdev

@yuefdev yuefdev commented Oct 18, 2026

Copy link
Copy Markdown

Check nil pointers before calling a contained value's IsZero method. Some((*time.Time)(nil)).IsZero() currently panics because the promoted value-receiver method dereferences a nil pointer. This can also break JSON encoding with omitzero.

The regression fails before the fix and covers typed nils, interface-wrapped nils and non-nil time values. Full tests, vet and gofmt pass. Race testing is unavailable locally because cgo is disabled and no GCC toolchain is installed.

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.

1 participant