Reduce exit point

This commit is contained in:
Tevin Zhang 2021-05-15 19:31:34 +08:00
parent 85c50599ef
commit b5c1b6e635
No known key found for this signature in database
GPG Key ID: EE7DA2A50F0960FB
1 changed files with 5 additions and 5 deletions

10
bool.go
View File

@ -83,10 +83,10 @@ func (ab *AtomicBool) MarshalJSON() ([]byte, error) {
// NOTE: There's no lock during the process, usually it shouldn't be called with other methods in parallel. // NOTE: There's no lock during the process, usually it shouldn't be called with other methods in parallel.
func (ab *AtomicBool) UnmarshalJSON(b []byte) error { func (ab *AtomicBool) UnmarshalJSON(b []byte) error {
var v bool var v bool
if err := json.Unmarshal(b, &v); err != nil { err := json.Unmarshal(b, &v)
return err
}
ab.SetTo(v) if err == nil {
return nil ab.SetTo(v)
}
return err
} }