From 821e3d1053703fe3e8599e6ed5cd958d8539197b Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Tue, 22 Jun 2021 12:53:52 +0545 Subject: [PATCH] check track before adding --- src/Structures/Queue.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index 9f948c3..e9a8d84 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -203,6 +203,7 @@ class Queue { */ addTrack(track: Track) { this.#watchDestroyed(); + if (!(track instanceof Track)) throw new Error("invalid track"); this.tracks.push(track); this.player.emit("trackAdd", this, track); } @@ -213,6 +214,7 @@ class Queue { */ addTracks(tracks: Track[]) { this.#watchDestroyed(); + if (!tracks.every((y) => y instanceof Track)) throw new Error("invalid track"); this.tracks.push(...tracks); this.player.emit("tracksAdd", this, tracks); }