diff options
author | 2023-05-16 20:08:00 -0400 | |
---|---|---|
committer | 2023-05-16 17:08:00 -0700 | |
commit | ad20b13985fd1cc045fe07a4560f8dd7087a43d7 (patch) | |
tree | 112226b65d5d833e153c4989fb26c307d7ecb199 /src | |
parent | 1ad8c54c90438c156ad068bdee1d70dfb9404db3 (diff) | |
download | bun-ad20b13985fd1cc045fe07a4560f8dd7087a43d7.tar.gz bun-ad20b13985fd1cc045fe07a4560f8dd7087a43d7.tar.zst bun-ad20b13985fd1cc045fe07a4560f8dd7087a43d7.zip |
Fix segfault on passing undefined to bun.build (#2902)
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/api/JSBundler.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bun.js/api/JSBundler.zig b/src/bun.js/api/JSBundler.zig index c95c359f1..741d956bf 100644 --- a/src/bun.js/api/JSBundler.zig +++ b/src/bun.js/api/JSBundler.zig @@ -494,6 +494,11 @@ pub const JSBundler = struct { globalThis: *JSC.JSGlobalObject, arguments: []const JSC.JSValue, ) JSC.JSValue { + if (arguments.len == 0 or !arguments[0].isObject()) { + globalThis.throwInvalidArguments("Expected a config object to be passed to Bun.build", .{}); + return JSC.JSValue.jsUndefined(); + } + var plugins: ?*Plugin = null; const config = Config.fromJS(globalThis, arguments[0], &plugins, globalThis.allocator()) catch { return JSC.JSValue.jsUndefined(); |