diff --git a/server/handlers/io.js b/server/handlers/io.js index d52f4c1d..a3a7d67c 100644 --- a/server/handlers/io.js +++ b/server/handlers/io.js @@ -301,17 +301,15 @@ module.exports = function() { }); socket.on('delete_all', function(msg) { - if(coll !== undefined) { - try { - coll = msg.channel.toLowerCase().replace(/ /g,''); - if(coll.length == 0) return; - coll = emojiStrip(coll).toLowerCase(); - coll = coll.replace(/_/g, ""); + try { + coll = msg.channel.toLowerCase().replace(/ /g,''); + if(coll.length == 0) return; + coll = emojiStrip(coll).toLowerCase(); + coll = coll.replace(/_/g, ""); - coll = filter.clean(coll); - } catch(e) { - return; - } + coll = filter.clean(coll); + } catch(e) { + return; } ListChange.delete_all(msg, coll, guid, offline, socket); diff --git a/server/handlers/list_change.js b/server/handlers/list_change.js index 1635fe59..ba6e0367 100644 --- a/server/handlers/list_change.js +++ b/server/handlers/list_change.js @@ -164,6 +164,10 @@ function addPlaylist(arr, guid, offline, socket) { var now_playing = false; if(np.length == 0) now_playing = true; db.collection(channel + "_settings").find({id: "config"}, function(e, conf) { + if(arr.length == 0) { + socket.emit("toast", "Empty list.."); + return; + } if(conf.length > 0) { var hash = Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(socketid, arr.adminpass), true)); if((conf[0].userpass == "" || !conf[0].userpass || conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, arr.userpass)).digest("base64"))) {