<p>When reversing a route with full or partial empty <code>to</code> and <code>from</code> inputs, we get an exception.</p>
<p>Steps to reproduce.</p>
<ul>
<li>open directions,</li>
<li>enter something in <code>to</code> input.</li>
<li>hit reverse directions</li>
<li>the variable <code>to</code> is undefined, but the properties <code>lat</code> and <code>lng</code> are accessed.</li>
</ul>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/2410353/73133630-d7695f80-402b-11ea-957c-82e76b2a375a.png"><img src="https://user-images.githubusercontent.com/2410353/73133630-d7695f80-402b-11ea-957c-82e76b2a375a.png" alt="image" style="max-width:100%;"></a></p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/2521'>https://github.com/openstreetmap/openstreetmap-website/pull/2521</a></p>
<h4>Commit Summary</h4>
<ul>
<li>Prevent exceptions while reversing directions</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2521/files#diff-0">app/assets/javascripts/index/directions.js</a>
(12)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2521.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/2521.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2521.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/2521.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2521?email_source=notifications&email_token=AAK2OLO6NHHDIP5GPHVN2IDQ7VOIXA5CNFSM4KLWABMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIXY7CQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNZ6M2ODGUAZHZUKWTQ7VOIXANCNFSM4KLWABMA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLOMDS5OLP42AIZLAG3Q7VOIXA5CNFSM4KLWABMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIXY7CQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2521?email_source=notifications\u0026email_token=AAK2OLO6NHHDIP5GPHVN2IDQ7VOIXA5CNFSM4KLWABMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIXY7CQ",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2521?email_source=notifications\u0026email_token=AAK2OLO6NHHDIP5GPHVN2IDQ7VOIXA5CNFSM4KLWABMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIXY7CQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>