fix AtomicError panic when Set nil (#1049) (#1050)

This commit is contained in:
NevS
2021-09-23 14:23:02 +08:00
committed by GitHub
parent 2e12cd2c99
commit 004ee488a6
2 changed files with 12 additions and 1 deletions

View File

@@ -9,7 +9,9 @@ type AtomicError struct {
// Set sets the error.
func (ae *AtomicError) Set(err error) {
ae.err.Store(err)
if err != nil {
ae.err.Store(err)
}
}
// Load returns the error.