res.tracks[0] is *null*
Hello, I am encountering this issue right now:
If i search a song using the title and author, i get an array of tracks from my search result.
However if I search something using a spotify track link, I get loadType "track" and res.tracks[0] is null
8 Replies
national-gold•2y ago
your code?
harsh-harlequinOP•2y ago
https://sourceb.in/78FjLwQcGn
i fixed it by adding this at the top:
but thats kinda stupid why not have every track into the res.tracks property
genetic-orange•2y ago
the error is in line 4
const track = res.tracks[0];
you are defining the music before checking the loadType
this way it is possible that the loadType is something other than "track" or "search" and thus giving error because nothing was foundharsh-harlequinOP•2y ago
the error was NOT an error when i was using erela.js
genetic-orange•2y ago
try this code:
harsh-harlequinOP•2y ago
thank you but I fixed it way easier:
genetic-orange•2y ago
nice!
GG @NedcloarBR, you just advanced to level 2!