From b8f2dda82464b70dff5c46fb4ea51ed9166d06e5 Mon Sep 17 00:00:00 2001 From: Auxane Thouary Date: Tue, 5 Dec 2023 10:43:10 +0100 Subject: [PATCH] fix(AsyncQueue): call the callback only if it's defined (#2370) --- modules/util/AsyncQueue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/util/AsyncQueue.js b/modules/util/AsyncQueue.js index e03b1ddea6..3c59bf754b 100644 --- a/modules/util/AsyncQueue.js +++ b/modules/util/AsyncQueue.js @@ -35,7 +35,7 @@ export default class AsyncQueue { clear() { for (const finishedCallback of this._taskCallbacks.values()) { try { - finishedCallback(new ClearedQueueError('The queue has been cleared')); + finishedCallback?.(new ClearedQueueError('The queue has been cleared')); } catch (error) { logger.error('Error in callback while clearing the queue:', error); }