Fixed this error:
TypeError: Cannot read property 'write' of undefined
at TLSSocket.<anonymous> (/home/debian/node/jbnc/bouncer.js:312:42)
at TLSSocket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at TLSSocket.Readable.push (_stream_readable.js:212:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
# Serious problem (uncaughtException) - this should not happen but the JBNC is still running. TypeError: Cannot read property 'write' of undefined
BOUNCER_ADMIN=config.bouncerAdmin?config.bouncerAdmin:'';
});
-// Prevent BNC from crashing for all other users when an error is caused by a user (with log error)
+// Prevent BNC from crashing for all other users when an error is caused by a user (with log error and time)
process.on('uncaughtException', (err, origin) => {
- console.error(`# Serious problem (${origin}) - this should not happen but the JBNC is still running. ${err.stack}`);
+ console.error(`${parseInt(Number(new Date()) / 1000)} # Serious problem (${origin}) - this should not happen but the JBNC is still running. ${err.stack}`);
});
if(this.lastping == command[1]) {
this.lastping='';
}
- else {
+ else if(this.hash && connections[this.hash]) {
connections[this.hash].write("PONG "+command[1]+"\n");
}
}