From 2507d6fa102488ed77b41a5893b311830f6fe9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 10 Aug 2023 05:30:25 +0200 Subject: fix(node/async_hooks): don't pop async context frame if stack if empty (#20077) Closes https://github.com/denoland/deno/issues/20076 --- ext/node/polyfills/async_hooks.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/node/polyfills/async_hooks.ts') diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index c97e81ef5..d0fc6a65e 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -22,8 +22,9 @@ function pushAsyncFrame(frame: AsyncContextFrame) { } function popAsyncFrame() { - assert(asyncContextStack.length > 0); - asyncContextStack.pop(); + if (asyncContextStack.length > 0) { + asyncContextStack.pop(); + } } let rootAsyncFrame: AsyncContextFrame | undefined = undefined; -- cgit v1.2.3