Fixed crash ran on version not on Modrinth
This commit is contained in:
+8
-1
@@ -122,7 +122,14 @@ public class ModrinthGetter
|
||||
|
||||
public static String getLatestIDForVersion(String mcVer)
|
||||
{
|
||||
return mcVerToReleaseID.get(mcVer).get(0);
|
||||
try
|
||||
{
|
||||
return mcVerToReleaseID.get(mcVer).get(0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static String getLatestNameForVersion(String mcVer)
|
||||
{
|
||||
|
||||
@@ -57,9 +57,11 @@ public class SelfUpdater
|
||||
*/
|
||||
public static boolean onStart()
|
||||
{
|
||||
LOGGER.info("Checking for DH update");
|
||||
// Some init stuff
|
||||
// We use sha1 to check the version as our versioning system is different to the one on modrinth
|
||||
if (!ModrinthGetter.init()) return false;
|
||||
if (!ModrinthGetter.init())
|
||||
return false;
|
||||
String jarSha = "";
|
||||
try
|
||||
{
|
||||
@@ -71,6 +73,11 @@ public class SelfUpdater
|
||||
return false;
|
||||
}
|
||||
String mcVersion = SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion();
|
||||
if (!ModrinthGetter.mcVersions.contains(mcVersion))
|
||||
{
|
||||
LOGGER.warn("Minecraft version ["+ mcVersion +"] is not findable on Modrinth, only findable versions are ["+ ModrinthGetter.mcVersions.toString() +"]");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the sha's of both our stuff
|
||||
if (jarSha.equals(ModrinthGetter.getLatestShaForVersion(mcVersion)))
|
||||
|
||||
Reference in New Issue
Block a user