From d732440e3e6eb4be5ef6a2458316176747901944 Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 9 Jan 2015 01:11:47 +0000 Subject: [PATCH] yeah yeah --- modules/r2rio/r2rio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/r2rio/r2rio.js b/modules/r2rio/r2rio.js index 7dcb7b6..abfce22 100644 --- a/modules/r2rio/r2rio.js +++ b/modules/r2rio/r2rio.js @@ -22,7 +22,7 @@ var gmaps = function(dbot) { }, 'json': true }, function(err, response, body) { - if(!err && body && _.has(body, 'routes')) { + if(!err && body && _.has(body, 'routes') && _.has(body.routes[0], 'duration') && _.has(body.routes[0], 'indicativePrice')) { var route = body.routes[0]; event.reply('If you left right now, it would take you ' + Math.floor(route.duration / 60) + ' hours and ' + (route.duration % 60) + ' minutes to get the ' + Math.floor(route.distance) + 'KM from ' + from + ' to ' + to + ', and cost you about £' +