guard against invoking a method of an undefined attribute, resulting in a memory puddle

pull/1/head
ansuz 5 years ago
parent 294fb5acb5
commit af59f4c2c2

@ -102,7 +102,9 @@ var getMetadataAtPath = function (Env, path, _cb) {
var closeChannel = function (env, channelName, cb) { var closeChannel = function (env, channelName, cb) {
if (!env.channels[channelName]) { return void cb(); } if (!env.channels[channelName]) { return void cb(); }
try { try {
env.channels[channelName].writeStream.close(); if (typeof(Util.find(env, [ 'channels', channelName, 'writeStream', 'close'])) === 'function') {
env.channels[channelName].writeStream.close();
}
delete env.channels[channelName]; delete env.channels[channelName];
env.openFiles--; env.openFiles--;
cb(); cb();

Loading…
Cancel
Save