Sure there is a risk of injury, but consider: when you are dropped on your head from at least a couple of feet, there's basically no friction. When you're lying in your berth, there's a lot of friction that keeps you from sliding forward as fast as you would be if you had fallen a couple of feet.
I've also noticed in those crash-test-boat videos that the boat didn't generally stop short when it hit something, but would skirt sideways or ride up it. I think the boat will absorb quite a bit of the impact.
I think damage to the hull is probably more of an issue that damage to your neck in the situation you're worried about.
That's not to say there's not a lot of sources of injury in a collision. Falling through a hatch or into the cockpit is pretty scary.
Anyway if you're concerned, you could wear a bike helmet while you sleep. They compress and absorb a lot of the energy of impact