diff --git a/internal/eval/store_eval.go b/internal/eval/store_eval.go index f9a3e26ec..c27597eab 100644 --- a/internal/eval/store_eval.go +++ b/internal/eval/store_eval.go @@ -203,6 +203,10 @@ func evalSET(args []string, store *dstore.Store) *EvalResponse { key, value = args[0], args[1] storedValue, oType := getRawStringOrInt(value) + if oType != object.ObjTypeInt && oType != object.ObjTypeString { + return makeEvalError(diceerrors.ErrUnsupportedEncoding(int(oType))) + } + for i := 2; i < len(args); i++ { arg := strings.ToUpper(args[i]) switch arg { @@ -294,10 +298,6 @@ func evalSET(args []string, store *dstore.Store) *EvalResponse { } } - if oType != object.ObjTypeInt && oType != object.ObjTypeString { - return makeEvalError(diceerrors.ErrUnsupportedEncoding(int(oType))) - } - // putting the k and value in a Hash Table store.Put(key, store.NewObj(storedValue, exDurationMs, oType), dstore.WithKeepTTL(keepttl)) if oldVal != nil {