Skip to content

Commit d54ca66

Browse files
committed
Fix a crash occurring when a jsFS callback is called without arguments
1 parent 3c2c4dc commit d54ca66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/natives/src/syscall/fs_js.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
2222
f := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
2323
var res callResult
2424

25-
if jsErr := args[0]; !jsErr.IsNull() {
26-
res.err = mapJSError(jsErr)
25+
if len(args) >= 1 {
26+
if jsErr := args[0]; !jsErr.IsNull() {
27+
res.err = mapJSError(jsErr)
28+
}
2729
}
2830

2931
res.val = js.Undefined()

0 commit comments

Comments
 (0)