Skip to content

Commit

Permalink
fix Any being evaluated if entry is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangaroux authored and phuslu committed Jun 30, 2024
1 parent cacf233 commit e800afc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,10 @@ func (e *Entry) EmbedObject(obj ObjectMarshaler) *Entry {

// Any adds the field key with f as an any value to the entry.
func (e *Entry) Any(key string, value any) *Entry {
if e == nil {
return nil
}

if value == nil || (*[2]uintptr)(unsafe.Pointer(&value))[1] == 0 {
e.buf = append(e.buf, ',', '"')
e.buf = append(e.buf, key...)
Expand Down

0 comments on commit e800afc

Please sign in to comment.