Updated

A U.S. Open official was criticized after French tennis star Alizé Cornet was hit with a code violation on Tuesday after she took off her shirt briefly during a match.

Cornet, 28, was battling Swedish tennis star Johanna Larsson at the U.S. Open in Flushing Meadows, N.Y., when the two athletes took a mandatory break due to the sweltering weather. When Cornet walked back onto the court she realized her shirt was on backward prompting her to quickly turn around, take off her top to reveal a black sports bra, before putting the shirt on the correct way.

Cornet walked back onto to the court ready to go when umpire Christian Rask slapped her with the penalty. She was then seen putting her hands up in exasperation after she was handed the penalty.

SERENA WILLIAMS, OTHER PARENTS SHARE #THISMAMA STORIES ABOUT LIFE WITH LITTLE ONES

The Women’s Tennis Association rulebook states that “medically approved clothing changes of female players must be performed off court in the most private location,” ABC News Australia reported. However, social media users pointed out that male tennis players often change their attire during matches including Novak Djokovic, who took his shirt off during an ice-bath on the court Tuesday.

Judy Murray, the mother of former U.S. Open winner Andy Murray, tweeted, “Alizé Cornet came back to court after 10 minute heat break. Had her fresh shirt on back to front. Changed at back of court. Got a code violation. Unsportsmanlike conduct…..But the men can change shirts on court.”

“Busted for code violation. Alizé Cornet took 10 seconds to turn top right way but Novak Djokovic can sit for minutes half-naked. Same comp. Days after Serena Williams [was] slammed for disrespecting tennis because she wore a #catsuit. Not fair. Not right. Tell your daughters,” another person tweeted.

Following the backlash, the US Open released a statement regarding the incident.

"All players can change their shirts when sitting in the player chair. This is not considered a code violation. We regret that the code violation was assessed to Ms. Cornet yesterday. We have clarified the policy to ensure this will not happen moving forward. Fortunately, she was only assessed a warning with no further penalty or fine. Female players, if they choose, may also change their shirts in a more private location close to the court, when available. They will not be assessed a bathroom break in this circumstance," the statement read.

The tennis world recently made headlines after the French Tennis Federation president told Tennis Magazine that the outfit Williams wore this year in Paris would no longer be accepted. Williams wore the outfit that she called her "Wakanda-inspired catsuit," referring to the fictional nation in the film "Black Panther."

1414e505-Serena Williams

Serena Williams was told she could not wear her "Wakanda-inspired catsuit.” (AP)

VENUS, SERENA WILLIAMS MAKE WINNING STARTS AT US OPEN

The full-length leggings were for health reasons, she said. In what was her first Grand Slam tournament since giving birth to her daughter last Sept. 1, the suit was a precaution after her health scare related to blood clots. A number of tennis stars including Billie Jean King and Andy Roddick criticized the decision to ban Williams’ outfit.

Cornet ended up losing the first-round match against Larsson, 6-4, 3-6, 2-6.

The Associated Press contributed to this report.