Would it even be reasonable that a civilisation capable of creating artificial wormholes couldn't stop a rogue planet? Oh yes, it would. Firstly, the commentators and answerers are right. If this was a Kardashev type 2 civilisation, then it should be able to fend off rogue planets. I suspect they could handle hypervelocity stars and neutron stars too. K2 civilisations will possess technology and science capable of doing things we wouldn't believe. This is background to my proposal.
I believe suggestions about K2 civilisations were made because they were aware that current models of wormholes require near stellar masses of energy to make them. However, science will march on, so let's assume that a century or two hence science discovers wormholes that can be easily created for smallish amounts of energy.
This gives a future Earth civilisation with practical interplanetary and interstellar travel via artificial wormholes. But they won't have the super-technology to save themselves from rogue planets and upwards. There's no choice other than a mass exodus.
As for the kind of rogue object destroying to destroy Earth, the Sun, or the solar system, they can be ranked as follows.
Rogue planets: Preferrably Jupiter mass. Earth doesn't have a chance. Could disrupt the Sun enough to make the solar system uninhabitable. Not easily detected. Travelling at around 30 kilometres per second (kps).
Hypervelocity stars. The solar system hasn't a chance. Easy to see coming though. Only travelling at roughly one-thousandth of lightspeed. So there's plenty of time to prepare.
Runaway neutron stars. The solar system hasn't a chance. The neutron star needs to be old, so it's cooled down, lost its high rotation and magnetic field. Otherwise it would be easy to see coming. Only travelling at around 30 kilometres per second (kps) or roughly one-ten-thousandth of lightspeed. Might be a nasty surprise.
Black holes. Really deadly especially if on collision course with the Sun. Hard to see coming. Though there might be giveaway signs of their presence. Gravitational perturbations, bursts of radiation, etc. No idea about their speed of approach. Needs further research.
Rogue planets are most sneaky, neutron stars might be but also could be easily spotted depending on its age. Hypervelocity stars will be seen for millennia before they arrive. Black holes can sneak up and really ruin the neighbourhood.
Conclusion: Assume artificial wormholes (as you said it's fantasy science) developed in the reasonably near future (say, only centuries ahead) and then choose the rogue object you prefer to wreak havoc.