aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-05-16 20:08:00 -0400
committerGravatar GitHub <noreply@github.com> 2023-05-16 17:08:00 -0700
commitad20b13985fd1cc045fe07a4560f8dd7087a43d7 (patch)
tree112226b65d5d833e153c4989fb26c307d7ecb199 /src
parent1ad8c54c90438c156ad068bdee1d70dfb9404db3 (diff)
downloadbun-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.zig5
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();