Chromecast backendfix

This commit is contained in:
Kasper Rynning-Tønnesen
2017-09-13 09:05:04 +02:00
parent a2e7bb7ffb
commit 62250f890a

View File

@@ -42,7 +42,7 @@ module.exports = function() {
try {
if(typeof(msg) == "object" && msg.hasOwnProperty("guid") && msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel")) {
db.collection("connected_users").find({"_id": msg.channel}, function(err, connected_users_channel) {
if(connected_users_channel.users.indexOf(msg.guid) > -1) {
if(connected_users_channel.length > 0 && connected_users_channel[0].users.indexOf(msg.guid) > -1) {
guid = msg.guid;
socketid = msg.socket_id;
socket.zoff_id = socketid;
@@ -51,7 +51,7 @@ module.exports = function() {
chromecast_object = true;
socket.join(coll);
}
})
});
}
} catch(e) {
return;