Added logic to catch empty playlist edgecase
This commit is contained in:
parent
95ae15815b
commit
34e662c1da
1 changed files with 6 additions and 0 deletions
|
|
@ -860,6 +860,12 @@ class playlistHandler{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If we found an empy playlist
|
||||||
|
if(foundPlaylist.media.length <= 0){
|
||||||
|
//ignore it!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Pick a random video ID based on the playlist's length
|
//Pick a random video ID based on the playlist's length
|
||||||
const foundID = Math.round(Math.random() * (foundPlaylist.media.length - 1));
|
const foundID = Math.round(Math.random() * (foundPlaylist.media.length - 1));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue