Skip to content

Commit

Permalink
fix(AsyncQueue): call the callback only if it's defined (#2370)
Browse files Browse the repository at this point in the history
  • Loading branch information
athouary committed Dec 6, 2023
1 parent 7841a38 commit 638e2c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/util/AsyncQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 638e2c0

Please sign in to comment.