What sucks is courts usually don't do anything about...anything until it's already been done to the child. I have some family who went through some very tough things. And finally it was bad enough that the courts finally realized "hey we should maybe remove the child out of the home and make the other parent get custody"
But the damage was already done. He is 11 now and just now getting that well deserved break from the sh*t head parent. He was all bruised up and tons of psychological damage.
But before this the courts never did anything about it. Even knowing the parent had drug problems and some arrests for some "minor" acts.
The best you can do on your part is keep an eye open and be the good parent. And that doesn't mean keeping the child away from the other parent because legally you can't do that. But being loving and supportive and just making sure the other parent isn't able to hurt them.