]> Cypherpunks repositories - keks.git/commitdiff
Move unscoped variable to condition check
authorSergey Matveev <stargrave@stargrave.org>
Tue, 21 Jan 2025 08:15:51 +0000 (11:15 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 10 Feb 2025 15:39:44 +0000 (18:39 +0300)
That will also check ctx.opts only if this is Str.

go/atom-decode.go

index 6fe0e54a40d628a556cb458afe012a866b4979febdf247535d4b806104e9effd..98e62ab822279b8342473b352b62c443ca44404f40406c62f90e3266ff92127f 100644 (file)
@@ -60,8 +60,7 @@ func (ctx *Decoder) DecodeAtom() (t types.Type, err error) {
                ctx.types = append(ctx.types, t)
                ctx.depths = append(ctx.depths, ctx.depth)
                ctx.strs = append(ctx.strs, s)
-               disabled := ctx.opts != nil && ctx.opts.DisableUTF8Check
-               if t == types.Str && !disabled {
+               if t == types.Str && !(ctx.opts != nil && ctx.opts.DisableUTF8Check) {
                        if !utf8.ValidString(s) {
                                err = ErrBadUTF8
                        }