SPOILERS for Agents of S.H.I.E.L.D. and Avengers: Infinity War ahead.

Marvel Studio’s latest, Avengers: Infinity War, actually spoils the Agents of S.H.I.E.L.D. season 5 finale because the movie takes place after the team saves Earth from certain destruction. All season, Phil Coulson and his team have searched for a way to save the Earth. The season 5 premiere showed viewers what would become of the Earth, cracked apart like an egg in the future, if the agents weren’t able to break from their time loop and save it. Since the team returned to the present, they’ve done everything they could to alter the timeline. But, since they don’t know what exactly the original timeline entails, it’s difficult for them - and the viewers - to know if they’ve changed it and saved the world.

Ever since Marvel Studios’ latest hit theaters, fans have wondered how Infinity War fits into the timeline of Agents of S.H.I.E.L.D. season 5. Last week’s episode featured a loose tie-in between Infinity War and Agents of S.H.I.E.L.D., but the most recent episode revealed season 5 connects more directly to the movie than many viewers were expecting. Based on these references to the movie, we can guess that these episodes take place at the same time as the events of Infinity War. After all, it’s unclear how much time passes over the course of the movie. However, now that we know more about how Agents of S.H.I.E.L.D. season 5 ties into Avengers: Infinity War, these connections actually work as a spoiler for the show’s season finale.

In the latest episode, “The One Who Will Save Us All,” General Talbot - now a version of the Marvel Comics villain Graviton - learns about the threat Thanos poses to the Earth. One member of the alien Confederacy, Taryan of the House Kasius, reveals they knew about Thanos’ impending attack on Earth and used it to extort resources from Earth. This causes Graviton to seek more power, potentially putting him on a world-ending path. However, viewers who have seen Avengers: Infinity War know that when Thanos actually arrives on Earth, at the end of the Battle of Wakanda, it’s still whole. As such, Infinity War confirms Agents of S.H.I.E.L.D. saved the Earth in or before the season 5 finale, spoiling the show’s season-long conflict.

This is contingent on what we currently know about the Agents of S.H.I.E.L.D. timeline fitting into Infinity war. We know that, as of “The One Who Will Save Us All,” Thanos has “begun an assault” on Earth - though it’s unclear if this is the Black Order’s fight against Iron Man, Doctor Strange and Spider-Man in New York City or the Battle of Wakanda. Further, we know that the ending of Avengers: Infinity War hasn’t come to pass yet since no one has disintegrated to dust as a result of Thanos’ finger snap. (It’s possible this has happened already, but it’s very unlikely that not a single member of S.H.I.E.L.D. or the aliens they’re interacting with, would disintegrate.)

Of course, it’s possible the final two episodes of Agents of S.H.I.E.L.D. season 5 will pull out a completely unexpected twist. Perhaps the agents lose half their team in the wake of Thanos’ universe-altering finger snap and that prevents them from saving the world. Perhaps Thanos’ finger snap was always a key event leading to the Earth being cracked apart and that happens as a result of his attack. But this would hinge on the Earth’s destruction arriving after Thanos uses the Infinity Gauntlet to wipe out half the universe. If that’s the case, then Infinity War may not have spoiled the end of Agents of S.H.I.E.L.D. season 5, which we’ve been told can act as a series finale if the show isn’t renewed for season 6.

However, there are only two episodes left this season. That leaves very little time for Agents of S.H.I.E.L.D. to deal with the fallout from Thanos’ finger snap and save the world. It seems more likely most of the rest of season 5 will continue to take place prior to the Battle of Wakanda. That way, the agents can work to prevent the world’s destruction and save Phil Coulson from dying, then deal with half the universe being erased. Certainly, since that worked as a cliffhanger ending for Infinity War, it could serve a similar function in Agents of S.H.I.E.L.D. Though, since S.H.I.E.L.D. hasn’t been renewed for season 6 yet, it may act as the final ending of the series.

Whether or not that happens remains to be seen. Fans will have to tune in to find out for sure whether Avengers: Infinity War truly did spoil the end of Agents of S.H.I.E.L.D. season 5.

Next: How Marvel TV May Handle Avengers: Infinity War’s Outcome

Agents of S.H.I.E.L.D. season 5 continues with “The Force of Gravity” Friday May 11 at 9pm ET on ABC.