Pfffffttt, we're SOOOOO lucky we have a spare barely 80 million miles away!
You can prevent & react, but you can't hide an entire planet or its moon from such trajectories.
So, say -- the theorized doomsday asteroid (or comet) isn't grabbed by the gravity pull of Jupiter (and other biggies) and heads up straight towards the sun... all we have to do is watch, cross-fingers & calculate some tricky situations. Duh.
In the meantime, the lucky observer (such as what happened above) can prove the risks, again.
But can't budget a coordinated defense of & by Earth. As if Armageddon & Deep Impact weren't enough, the next comet will obliterate (100% certainty, as of now) humanity unless intercepted.
15 years, that's all it took. Centuries worth of exploration ahead though.
Mars isn't a feasible solution nor is Venus. Earth is.
ET call home. Is it still there?