I think the game is helping you out a bit in that instance. If it did target the nearest star, you'd get partway there, discover the black hole, and then be stuck in an endless loop with the only ways out being entering the combat you fled from or diving into the black hole.
It's a little bit unrealistic, but better than the alternative.
Kudos to Fingers for the catch.
