Skip to content

Commit

Permalink
Handle undefined redis_version
Browse files Browse the repository at this point in the history
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!).
  • Loading branch information
slaskis committed Feb 17, 2014
1 parent f601965 commit 0367a64
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0367a64

Please sign in to comment.