From 0367a64bff369bafed1c16d362967758f0dacd8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sk=C3=B6ld?= Date: Mon, 17 Feb 2014 13:26:16 +0100 Subject: [PATCH] Handle undefined redis_version Apparently some servers don't send the redis_version with the INFO command (*cough* redis cloud *cough*). This causes the app to crash violently (yay node!). --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7f0fd588b9..6e87bb123d 100644 --- a/index.js +++ b/index.js @@ -378,9 +378,11 @@ RedisClient.prototype.on_info_cmd = function (err, res) { }); obj.versions = []; - obj.redis_version.split('.').forEach(function (num) { - obj.versions.push(+num); - }); + if( obj.redis_version ){ + obj.redis_version.split('.').forEach(function (num) { + obj.versions.push(+num); + }); + } // expose info key/vals to users this.server_info = obj;