Skip to content

Commit

Permalink
Erros skip nil in Add function (go-gorm#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 authored and jinzhu committed Sep 4, 2017
1 parent 981d5db commit 6e45625
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func (errs Errors) GetErrors() []error {
// Add adds an error
func (errs Errors) Add(newErrors ...error) Errors {
for _, err := range newErrors {
if err == nil {
continue
}

if errors, ok := err.(Errors); ok {
errs = errs.Add(errors...)
} else {
Expand Down

0 comments on commit 6e45625

Please sign in to comment.