diff options
author | 2022-10-23 20:27:03 -0500 | |
---|---|---|
committer | 2022-10-23 18:27:03 -0700 | |
commit | 14cec299f5170b8ed35eed28e53b88724b8cc04f (patch) | |
tree | dcf814b0ae75ba93b0594a46d8a29db4d5d2b6fb /src | |
parent | 55c42f166332b143649b5770ae9f9c48104c1ea0 (diff) | |
download | bun-14cec299f5170b8ed35eed28e53b88724b8cc04f.tar.gz bun-14cec299f5170b8ed35eed28e53b88724b8cc04f.tar.zst bun-14cec299f5170b8ed35eed28e53b88724b8cc04f.zip |
fix(fetch): stop `new Response(null)` from segfaulting (#1383)
* fix(fetch): resolve segfaults with 'Response'
* nit: use shorter check
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/webcore/response.zig | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index 99205d440..c47648a5d 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -4673,19 +4673,12 @@ pub const Body = struct { pub fn fromJS(globalThis: *JSGlobalObject, value: JSValue) ?Value { value.ensureStillAlive(); - if (value.isEmpty() or value.isUndefined()) { + if (value.isEmptyOrUndefinedOrNull()) { return Body.Value{ .Empty = void{}, }; } - if (value.isNull()) { - var null_str: [4]u8 = "null".*; - - // this looks like a pointer to stack memory, but it will be copied - return Body.Value.createBlobValue(&null_str, undefined, true); - } - const js_type = value.jsType(); if (js_type.isStringLike()) { |