Skip to content

Commit

Permalink
Merge pull request #95 from corani/nil_len
Browse files Browse the repository at this point in the history
fix: handle nil pointer in Len function of Error struct
  • Loading branch information
shore committed Mar 25, 2024
2 parents 162d070 + 8c18557 commit 6eb9592
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sort.go
Expand Up @@ -4,7 +4,11 @@
package multierror

// Len implements sort.Interface function for length
func (err Error) Len() int {
func (err *Error) Len() int {
if err == nil {
return 0
}

return len(err.Errors)
}

Expand Down

0 comments on commit 6eb9592

Please sign in to comment.