Naya Rivera wasn't "shocked" when she found out about Mark Salling's arrest on child porn charges.

Naya Rivera

Naya Rivera

The former 'Glee' actress was devastated when she split from her former co-star in 2010 but she admits she was relieved they were no longer together when she learned in December 2015 he had been apprehended by police.

In the 29-year-old star's forthcoming memoir, 'Sorry Not Sorry: Dreams, Mistakes and Growing Up', she wrote: "My son's nanny actually told me about it when the story broke.

"I can't say I was totally shocked, but still -- WTF? Then I had no doubt that God really did have my back along the way.

"When Mark dumped me, I thought it was the worst thing ever, but can you imagine if that didn't happen? And I was laying there in bed when the battering ram came through the door?"

Meanwhile, Naya claims the 34-year-old disgraced star - who has pleaded not guilty to two charges of receiving and possessing child pornography and will face trial later this year - told her he had to pretend he was single to maintain his poster boy image, but she thinks it was more to do with him making it OK to have sex with other women.

She writes: "I had a feeling his pretending to be single had less to do with his publicist and more to do with his d**k."

Naya - who is now married to Ryan Dorsey, with whom she has a son, Josey, 11 months - also claims that every time a new girl would arrive on the set of the FOX show they would be hounded by Mark.

She writes: "For a while, there was drama on set, because we hated each other and I didn't even want him looking at me.

"Any time a new person was added to the show, it was like fresh meat being dropped into a piranha tank."

The 'Devious Maids' star also admitted she regrets everything about their relationship.

She adds: "I think everyone should have that one relationship where you look back and ask yourself, 'What the hell was I thinking?' You'll learn something and you won't regret it.

"Unless, of course, that relationship was with someone who had a sizable stash of child porn on his computer. Then, by all means, regret everything."