From 4412bfc72733658199dd8947933dbf083d43f55e Mon Sep 17 00:00:00 2001 From: Star Date: Wed, 16 Oct 2024 11:47:38 +0800 Subject: [PATCH] check is valid fo .object() --- http.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http.go b/http.go index 82b42e5..519df53 100644 --- a/http.go +++ b/http.go @@ -138,7 +138,9 @@ func toObject(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value { if data, ok := dataValue.Export().([]byte); ok { obj := u.UnJsonBytes(data, nil) v := u.FinalValue(reflect.ValueOf(obj)) - return vm.ToValue(v.Interface()) + if v.IsValid() { + return vm.ToValue(v.Interface()) + } } return nil }