From e75be1967d203da9f18a2825ec01663afe56a96c Mon Sep 17 00:00:00 2001 From: Matthew Lloyd Date: Thu, 4 Apr 2013 10:23:46 +0100 Subject: [PATCH] Fixing a null object ref error with meta. Meta is an optional param, however if it omitted then we had a null object reference error. --- lib/winston/transports/http.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/winston/transports/http.js b/lib/winston/transports/http.js index fc62b9ec3..9d6f27bc3 100644 --- a/lib/winston/transports/http.js +++ b/lib/winston/transports/http.js @@ -86,16 +86,18 @@ Http.prototype.log = function (level, msg, meta, callback) { } }; - if (meta.path) { - options.path = meta.path; - delete meta.path; - } + if (meta) { + if (meta.path) { + options.path = meta.path; + delete meta.path; + } - if (meta.auth) { - options.auth = meta.auth; - delete meta.auth; + if (meta.auth) { + options.auth = meta.auth; + delete meta.auth; + } } - + this._request(options, function (err, res, body) { if (res && res.statusCode !== 200) { err = new Error('HTTP Status Code: ' + res.statusCode);