From dd98807e46f7a90f090d766e486b7ab842224970dae93f545cbff869ce1cb975 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 21 Jan 2025 11:15:51 +0300 Subject: [PATCH] Move unscoped variable to condition check That will also check ctx.opts only if this is Str. --- go/atom-decode.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go/atom-decode.go b/go/atom-decode.go index 6fe0e54..98e62ab 100644 --- a/go/atom-decode.go +++ b/go/atom-decode.go @@ -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 } -- 2.48.1