Fixed issue with correct title not returning result

This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-03 12:12:32 +01:00
parent fa7071ecb6
commit 740cf021f8
2 changed files with 12 additions and 5 deletions

View File

@@ -45,15 +45,23 @@ function get_correct_info(song_generated, channel, broadcast, callback) {
io.to(channel).emit("channel", {type: "changed_values", value: song_generated});
}
} else {
callback(song_generated, true);
if(typeof(callback) == "function") {
callback(song_generated, true);
}
}
});
} else {
if(typeof(callback) == "function") {
callback(song_generated, true);
}
}
} else {
findSimilar(song_generated, channel, broadcast, callback)
}
} catch(e){
callback({}, false);
if(typeof(callback) == "function") {
callback({}, false);
}
}
});
}
@@ -123,7 +131,7 @@ function findSimilar(msg, channel, broadcast, callback) {
io.to(channel).emit("channel", {type: "changed_values", value: element});
}
}
if(callback) {
if(typeof(callback) == "function") {
msg.title = element.title;
msg.id = element.id;
msg.duration = element.duration;
@@ -132,7 +140,7 @@ function findSimilar(msg, channel, broadcast, callback) {
callback(msg, true);
}
});
} else if(callback) {
} else if(typeof(callback) == "function") {
callback({}, false);
}
});