Skip to content

Commit 6108274

Browse files
committed
Merge pull request #171 from CodeforAustralia/Distance-missing-results
Fixed distance display to deal with missing results
2 parents 4815c93 + 257ece1 commit 6108274

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

js/google_geocoder.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ function callBacker(selector) {
7070
// outputDiv.innerHTML = '';
7171
// origins[i] + ' to ' + destinations[j]
7272
var results = response.rows[0].elements;
73-
outputDiv.html(', or via roads: '
74-
+ results[0].distance.text.split(' ').join(' ') + ' in '
75-
+ results[0].duration.text.split(' ').join(' ') + ' cycling');
73+
if (results[0].status === "ZERO_RESULTS"){
74+
// zip
75+
}
76+
else{
77+
outputDiv.html('Via roads: '
78+
+ results[0].distance.text.split(' ').join(' ') + ' in '
79+
+ results[0].duration.text.split(' ').join(' ') + ' cycling');
80+
}
7681
}
7782
};
7883

0 commit comments

Comments
 (0)