From d19005aa762b55114d26dabe4931a8c8aa3bfaae Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Mon, 17 Apr 2023 05:46:44 -0700 Subject: Fix access of inactive union field --- src/bun.js/api/server.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/bun.js/api') diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 1390a4aa8..40a78f5c2 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -5003,13 +5003,14 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { }, }; resp.onData(*RequestContext, RequestContext.onBufferedBodyChunk, ctx); - } else { - // no content-length or 0 content-length - // no transfer-encoding + } else if (request_object.body == .Locked) { + // This branch should never be taken, but we are handling it anyway. var old = request_object.body; old.Locked.onReceiveValue = null; request_object.body = .{ .Null = {} }; old.resolve(&request_object.body, this.globalThis); + } else { + request_object.body = .{ .Null = {} }; } } -- cgit v1.2.3