Should I get a lawyer?

I’m currently 6 months pregnant and me and my baby’s father are currently together but we’re having problems… if we end up breaking up he’s threatening to take me to court for sole custody of the baby. What should I do? I don’t want to keep his child away from him he can see/spend as much time as he wants with her but I want her to live with me