From 5232f0e74dd5d2c515acb1c85b76977a6d87dc8c Mon Sep 17 00:00:00 2001 From: roo2 Date: Sun, 9 Apr 2017 14:55:24 +1000 Subject: [PATCH] fix crash in logger if message is null or undefined --- lib/core/logger.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/core/logger.js b/lib/core/logger.js index 729d6a17..0bcf0994 100644 --- a/lib/core/logger.js +++ b/lib/core/logger.js @@ -12,35 +12,35 @@ class Logger { } Logger.prototype.error = function (txt) { - if (!(this.shouldLog('error'))) { + if (!txt || !(this.shouldLog('error'))) { return; } this.logFunction(txt.red); }; Logger.prototype.warn = function (txt) { - if (!(this.shouldLog('warn'))) { + if (!txt || !(this.shouldLog('warn'))) { return; } this.logFunction(txt.yellow); }; Logger.prototype.info = function (txt) { - if (!(this.shouldLog('info'))) { + if (!txt || !(this.shouldLog('info'))) { return; } this.logFunction(txt.green); }; Logger.prototype.debug = function (txt) { - if (!(this.shouldLog('debug'))) { + if (!txt || !(this.shouldLog('debug'))) { return; } this.logFunction(txt); }; Logger.prototype.trace = function (txt) { - if (!(this.shouldLog('trace'))) { + if (!txt || !(this.shouldLog('trace'))) { return; } this.logFunction(txt);