Gravity generators have a range within which they operate. They don't stop at the hull of your ship. It might be a bit surprising, but it's not a bug.