forked from mirror/abool
Reduce exit point
This commit is contained in:
parent
85c50599ef
commit
b5c1b6e635
10
bool.go
10
bool.go
|
@ -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.
|
||||
func (ab *AtomicBool) UnmarshalJSON(b []byte) error {
|
||||
var v bool
|
||||
if err := json.Unmarshal(b, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
err := json.Unmarshal(b, &v)
|
||||
|
||||
ab.SetTo(v)
|
||||
return nil
|
||||
if err == nil {
|
||||
ab.SetTo(v)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue