{"action":"created","issue":{"url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/4","repository_url":"https://api.github.com/repos/perliedman/lrm-mapbox","labels_url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/4/comments","events_url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/4/events","html_url":"https://github.com/perliedman/lrm-mapbox/issues/4","id":153250109,"number":4,"title":"More than two waypoints cause error!","user":{"login":"otodockal","id":2613273,"avatar_url":"https://avatars.githubusercontent.com/u/2613273?v=3","gravatar_id":"","url":"https://api.github.com/users/otodockal","html_url":"https://github.com/otodockal","followers_url":"https://api.github.com/users/otodockal/followers","following_url":"https://api.github.com/users/otodockal/following{/other_user}","gists_url":"https://api.github.com/users/otodockal/gists{/gist_id}","starred_url":"https://api.github.com/users/otodockal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otodockal/subscriptions","organizations_url":"https://api.github.com/users/otodockal/orgs","repos_url":"https://api.github.com/users/otodockal/repos","events_url":"https://api.github.com/users/otodockal/events{/privacy}","received_events_url":"https://api.github.com/users/otodockal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-05T14:58:52Z","updated_at":"2016-05-06T11:15:24Z","closed_at":"2016-05-05T20:26:48Z","body":"Hi,\r\nI experience this error about two days now when I add more than two waypoints.\r\nMaybe something changed on Mapbox side, but I'm not in yet...\r\n\r\n**TypeError: Cannot read property 'lat' of undefined**\r\n\r\nCheck out this row:\r\nhttps://github.com/perliedman/lrm-mapbox/blob/master/src/L.Routing.Mapbox.js#L220\r\n\r\n...looks like when you create more than two waypoints, size of array wpIndices is always smaller. It accesses index here:\r\nhttps://github.com/perliedman/leaflet-routing-machine/blob/983201565c7417128c85b6a26b83653902f6cbfe/src/L.Routing.Line.js#L88\r\n\r\nI did quick fix in my custom L.Routing.Mapbox.js script like this, but it's not correct, of course...\r\n`\r\nif (wpIndices.length < waypoints.length) wpIndices.push(coordinates.length - 1);\r\n`\r\n\r\nThank you.\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/comments/217413790","html_url":"https://github.com/perliedman/lrm-mapbox/issues/4#issuecomment-217413790","issue_url":"https://api.github.com/repos/perliedman/lrm-mapbox/issues/4","id":217413790,"user":{"login":"petervojtek","id":225506,"avatar_url":"https://avatars.githubusercontent.com/u/225506?v=3","gravatar_id":"","url":"https://api.github.com/users/petervojtek","html_url":"https://github.com/petervojtek","followers_url":"https://api.github.com/users/petervojtek/followers","following_url":"https://api.github.com/users/petervojtek/following{/other_user}","gists_url":"https://api.github.com/users/petervojtek/gists{/gist_id}","starred_url":"https://api.github.com/users/petervojtek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petervojtek/subscriptions","organizations_url":"https://api.github.com/users/petervojtek/orgs","repos_url":"https://api.github.com/users/petervojtek/repos","events_url":"https://api.github.com/users/petervojtek/events{/privacy}","received_events_url":"https://api.github.com/users/petervojtek/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T11:15:24Z","updated_at":"2016-05-06T11:15:24Z","body":"@perliedman, thank you a lot for quick response and new release :)"}}