Fix crash in process.env.FOO = bar that happened sometimes

This commit is contained in:
Jarred Sumner
2022-11-18 03:47:10 -08:00
parent f6779193c0
commit f3fb712051
12 changed files with 45 additions and 26 deletions

View File

@@ -1950,7 +1950,7 @@ pub const EventListenerMixin = struct {
ctx: *CtxType,
comptime onError: fn (ctx: *CtxType, err: anyerror, value: JSValue, request_ctx: *http.RequestContext) anyerror!void,
) !void {
if (comptime JSC.is_bindgen) unreachable;
JSC.markBinding(@src());
var listeners = vm.event_listeners.get(EventType.fetch) orelse (return onError(ctx, error.NoListeners, JSValue.jsUndefined(), request_context) catch {});
if (listeners.items.len == 0) return onError(ctx, error.NoListeners, JSValue.jsUndefined(), request_context) catch {};