Can you masturbate while pregnant?

Can I masturbate if I'm pregnant? Or is that bad for the baby