[openstreetmap/openstreetmap-website] Prevent exceptions while reversing directions (#2521)
Holger Jeromin
notifications at github.com
Sun Jan 26 10:55:15 UTC 2020
HolgerJeromin commented on this pull request.
> @@ -142,12 +142,20 @@ OSM.Directions = function (map) {
$(".directions_form .reverse_directions").on("click", function () {
var from = endpoints[0].latlng,
- to = endpoints[1].latlng;
+ to = endpoints[1].latlng,
+ routeFrom = "",
+ routeTo = "";
+ if (from) {
+ routeFrom = from.lat + "," + from.lng;
+ }
+ if (to) {
+ routeTo = to.lat + "," + to.lng;
+ }
OSM.router.route("/directions?" + querystring.stringify({
from: $("#route_to").val(),
to: $("#route_from").val(),
We probably should rename the variables if they are too confusing here. But I wanted a minimal fix in the first place.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2521#discussion_r370989660
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200126/45a595cd/attachment-0001.htm>
More information about the rails-dev
mailing list