Add safeguard to prevent #539

This commit is contained in:
calzoneman 2015-12-02 20:59:46 -08:00
parent 54cabc04e1
commit 59468ec77c
1 changed files with 15 additions and 2 deletions

View File

@ -475,16 +475,29 @@ PlaylistModule.prototype.queueStandard = function (user, data) {
}
function handleLookup() {
var channelName = self.channel.name;
InfoGetter.getMedia(data.id, data.type, function (err, media) {
if (err) {
error(XSS.sanitizeText(String(err)));
if (self.channel && self.channel.activeLock) {
self.channel.activeLock.release();
} else {
Logger.errlog.log("Attempted release of channel lock after " +
"channel was already unloaded in queueStandard: " +
channelName + " " + data.type + ":" + data.id);
}
return lock.release();
}
self._addItem(media, data, user, function () {
lock.release();
if (self.channel && self.channel.activeLock) {
self.channel.activeLock.release();
} else {
Logger.errlog.log("Attempted release of channel lock after " +
"channel was already unloaded in queueStandard: " +
channelName + " " + data.type + ":" + data.id);
}
});
});
}