In his novel Rendezvous with Rama , Arthur C. Clarke created an organization called Spaceguard whose mission it was to protect Earth from just such dangers. It is estimated that there are some 2,000 NEOs that are more than 1km wide which have the potential of colliding with Earth. Unfortunately, due primarily to lack of funding, only about 245 of these have had their orbits charted. That's a long time to avoid the executioner's ax. Given enough advance notice, we have the technology to potentially alter the trajectory of an incoming asteroid so that it misses our planet.
Comets are a different story, however.
Because of the high speed at which they orbit the sun, there might be nothing that we can do to prevent our demise should a comet be sighted barreling toward us. But the greatest danger comes from asteroids, so we should do what we can in that area. If you compare it to the amount that governments spend on military hardware or presidential candidates spend on campaigning, not that much. The recommended approach was to build two 2-meter aperture telescopes that would be dedicated to the project . I don't really think we're all going to die next Tuesday afternoon because of an asteroid impact.