GANGNEUNG, South Korea — The first notes of Ed Sheeran’s “Shape of You” had just played when Gabriella Papadakis suddenly became aware that people were about to see a whole lot more of her shape than she had planned.

The French ice dancer’s glittering emerald costume at the Olympics had come unhooked at the neckline, and later in the routine, her left breast was exposed live on television.

When the clasp became unhooked, the 22-year-old Papadakis was more worried about holding up her outfit than making sure her twizzles and rhumba were in sync. Her swinging short program with partner Guillaume Cizeron at the PyeongChang Olympics was threatening to go down in history alongside Janet Jackson’s infamous wardrobe malfunction during her halftime performance at the Super Bowl.

“I felt it right away and I prayed,” Papadakis said. “That’s about what I could do.”

Somehow, the French couple kept things together through most of their Latin program, producing a score of 81.93 points Monday that left them second behind Canadian stars Tessa Virtue and Scott Moir.

Not all the program, though.

It was during the final element, when Papadakis leaned back in Cizeron’s arms, that her costume rode upward to reveal her breast. The performance was being shown live on international television, and people immediately began posting screen-grabs of the incident on social media.

“Our coverage of ice dancing was live tonight. Once a competitor’s brief wardrobe issue became evident, we purposely used wider camera shots and carefully selected replays to keep the issue obscured,” NBC said in a statement to the Associated Press. “We have edited the video for all television encores and online replays.”

It was the second wardrobe mishap during the skating program at the PyeongChang Games. American-born ice dancer Yura Min, competing for South Korea, had the back of her costume come unclasped during her short program with partner Alex Gamelin in the team competition.

Papadakis and Cizeron, considered the biggest threat to Virtue and Moir for gold, still managed to gain level-four marks for all their elements save their final straight line lift. That left the French duo less than two points behind their Canadian training partners on a packed leaderboard.

It’s unclear whether the judges docked the couple for the wardrobe issue. The rules state losing any part of a costume, even a hair clip, can lead to a one-point deduction.

“It’s a little bit frustrating to know that it’s not because of something that we did,” Cizeron said. “It’s just a costume issue, something as stupid as that, so it’s a little bit disappointing.”

Papadakis was nearly in tears as she approached reporters after the routine, which is required of any Olympic competitor after competition. But she was in better spirits an hour later, when she no doubt realized that her chance of a gold medal was still intact.

“It was pretty distracting, kind of my worst nightmare happening at the Olympics,” Papadakis said. “I told myself, ‘I don’t have a choice. I have to keep going,’ and that’s what we did. I think we can be proud of ourselves being able to deliver a great performance with that happening.”