Prevent js errors upon null artist or album

This commit is contained in:
Fabio Manganiello 2018-12-30 15:43:09 +01:00
parent 699fa92c5e
commit 9e28379203

View file

@ -445,6 +445,18 @@ $(document).ready(function() {
} }
files = files.sort(function(a, b) { files = files.sort(function(a, b) {
if ((a.artist && !b.artist) || (a.album && !b.album)) {
return -1;
}
if ((!a.artist && b.artist) || (!a.album && b.album)) {
return 1;
}
if ((a.artist && b.artist) || (a.album && b.album)) {
return 0;
}
if (a.artist === b.artist) { if (a.artist === b.artist) {
if (a.album === b.album) { if (a.album === b.album) {
return parseInt(a.track) < parseInt(b.track) ? -1 : 1; return parseInt(a.track) < parseInt(b.track) ? -1 : 1;