Fix crashing on MC 1.20.1 and older when updates aren't found 2

This commit is contained in:
James Seibel
2025-03-01 09:19:52 -06:00
parent f251c90472
commit 0fba015f54
2 changed files with 10 additions and 8 deletions
@@ -82,6 +82,7 @@ public abstract class MixinMinecraft
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
)); ));
return;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -90,10 +91,10 @@ public abstract class MixinMinecraft
LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"]."); LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"].");
} }
} }
else
{ // Sets the screen back to the vanilla screen as if nothing ever happened
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened // if not done the game will crash
} instance.setScreen(guiScreen);
} }
#endif #endif
@@ -63,6 +63,7 @@ public class MixinMinecraft
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
)); ));
return;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -71,10 +72,10 @@ public class MixinMinecraft
LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"]."); LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"].");
} }
} }
else
{ // Sets the screen back to the vanilla screen as if nothing ever happened
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened // if not done the game will crash
} instance.setScreen(guiScreen);
} }
#endif #endif