True, but it also deliberately sends a few our way too. See comet lexell for example. A long period comet, it encounter Jupiter which sent it into a short period orbit and passed earth at a miss distance of 0.15 AU in 1770. This is the closest confirmed comet ever recorded (the comet of 1491 may have come closer at 0.0094 AU, but there is still a large uncertainty in its reconstructed orbit).
Also, there is a greater statistical probability of earth colliding with a short period comet than a long period comet, and gravitationally it is Jupiter that dominates the transformation of long periods to short period comets. So while its gravity does help suck up or deflect potential long period earth crossers (whose velocity at earths orbit would cause a seriously large energetic impact), it depends upon its mood as to whether it is beneficent or maleficent.
Jonny
The path to good scholarship is paved with imagined patterns. - David M Raup