I'm not sure what their thinking was here regarding this matter, but there is this exchange from ANH I've just copy pasted from another site:
How long before you can make the jump to light speed?
It'll take a few moments to get the coordinates from the navi-computer.
The ship begins to rock violently as lasers hit it.
Are you kidding? At the rate they're gaining...
Traveling through hyperspace isn't like dusting crops, boy! Without precise calculations we could fly right through a star or bounce too close to a supernova and that'd end your trip real quick, wouldn't it?
I always just thought they meant that even in hyperspace, it might be a bad idea to travel directly through a star or supernova or black hole as it could tear you from hyperspace and then you're in the middle of said obstacle.
I've based that assumption on the precedent set by the ships (which I think are called Interdictors) that can prevent another vessel using hyperspace to escape or pull it out of hyperspace, using gravity well generators. Which in the context of that exchange suggests to me that travelling too close to anything that has a large gravitational pull in hyperspace is a no no, not that you'll necessarily hit it.