A study published Wednesday had some frightening news for the Great Barrier Reef—the iconic marine ecosystem is at "unprecedented" risk of collapse due to climate change after a 2016 heat wave led to the largest mass coral bleaching event in the reef's history.

But another study published Thursday in PLOS Genetics offers some hope: Corals are still in danger from climate change, but we have an extra 50 years to act to save them.

Researchers from the University of Texas (UT) at Austin, the University of Melbourne and the Australian Institute of Marine Science found that corals in the Great Barrier Reef have enough genetic diversity to survive rising ocean temperatures for another century, which is half-a-century more than previously thought.

"It means these corals will still go extinct if we do nothing," UT Austin professor and lead study author Mikhail Matz said in a UT press release. "But it also means we have a chance to save them. It buys us time to actually do something about global warming, which is the main problem."

Heat is a problem for corals because it causes the algae that live inside them, providing both color and nutrients, to release toxins. The corals then expels the algae. Without the algae, coral bleaches, or turns white, and eventually starves.

The researchers obtained their results using a mix of genetic sampling and computer simulations. They focused on the staghorn coral Acropora millepora, which is a species that plays a significant role in building the Great Barrier Reef.

The current study builds on previous research in which Matz and his team had found corals within this species that had more heat resistant genes than others.

For the current study, they looked at what would happen to coral populations containing these variations as temperatures warm. When the coral colonies reproduce, they release millions of larvae that float on ocean currents before settling in a new location. As waters warm, the more heat-resistant larvae survive, improving the resilience of the colonies they join. This is the process that could buy corals another 50 years.

"This genetic variation is like fuel for natural selection," Matz said in the press release. "If there is enough of it, evolution can be remarkably fast, because all it needs to do is reshuffle the existing variants between the populations. It doesn't have to wait for a new mutation to appear; it's already there. The problem is, when the genetic variation is exhausted, it is over and the future is unclear."

Matz said his research could provide a guide for conservation efforts: Instead of trying to genetically engineer super corals in the lab, scientists should simply mix hardier, existing varieties in with less heat-resistant populations and let evolution do its work.