From 421c331333da8fd4e3d18bce681fc2c4561b184c Mon Sep 17 00:00:00 2001 From: Chan Wen Xu Date: Mon, 22 Mar 2021 22:22:07 +0800 Subject: [PATCH] fix: Call FromJSValue using the correct parameter --- wasm/function.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wasm/function.go b/wasm/function.go index 5b29f35..81ea4b9 100644 --- a/wasm/function.go +++ b/wasm/function.go @@ -83,13 +83,13 @@ func conformJSValueToType(funcType reflect.Type, this js.Value, values []js.Valu in := make([]reflect.Value, 0, len(values)) for i, v := range values { paramType := funcType.In(i) - x := reflect.Zero(paramType).Interface() - err := FromJSValue(v, &x) + ptrX := reflect.New(paramType).Interface() + err := FromJSValue(v, ptrX) if err != nil { return nil, err } - in = append(in, reflect.ValueOf(x)) + in = append(in, reflect.ValueOf(ptrX).Elem()) } return in, nil