Skip to content

Commit 0367a64

Browse files
committed
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!).
1 parent f601965 commit 0367a64

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,11 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
378378
});
379379

380380
obj.versions = [];
381-
obj.redis_version.split('.').forEach(function (num) {
382-
obj.versions.push(+num);
383-
});
381+
if( obj.redis_version ){
382+
obj.redis_version.split('.').forEach(function (num) {
383+
obj.versions.push(+num);
384+
});
385+
}
384386

385387
// expose info key/vals to users
386388
this.server_info = obj;

0 commit comments

Comments
 (0)