Until custody is decided by agreement or court order, both parents have equal rights to the children. Most of the time the courts “award” primary physical custody to the parent who has been the primary caregiver. Since she has been the primary caregiver, as long as the child is in no physical danger, there is no reason to think that would change. If it comes to that though, the court will look at the history of both parents, their ability to care for and provide for the child and their willingness to do that. The best scenario is for the child/children to have both parents as involved in their lives as much as possible but sometimes that’s just not an option. Keep in mind that unless it’s stated, NC defaults to joint legal custody regardless of which parent has primary physical custody.
I suggest that she get a separation agreement with her stbx that includes custody so that she can relax a little on the custody issue.
Having an affair usually has little to do with custody issues. That is something that the spouse does that does not normally involve the children…“on their own time” so to speak.