From 1c9a00bf1a72bea45748990e57f9aafaa72a6b5e Mon Sep 17 00:00:00 2001 From: DevAndromeda <46562212+DevAndromeda@users.noreply.github.com> Date: Mon, 6 Sep 2021 20:12:11 +0545 Subject: [PATCH] fix(Queue): watch destroyed state for insert method --- src/Structures/Queue.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index bf6c53b..3289d95 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -534,6 +534,7 @@ class Queue { * @param {number} [index=0] The index where this track should be */ insert(track: Track, index = 0) { + if (this.#watchDestroyed()) return; if (!track || !(track instanceof Track)) throw new PlayerError("track must be the instance of Track", ErrorStatusCode.INVALID_TRACK); if (typeof index !== "number" || index < 0 || !Number.isFinite(index)) throw new PlayerError(`Invalid index "${index}"`, ErrorStatusCode.INVALID_ARG_TYPE);