diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java index 218de892f..76a05254d 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/LauncherActivity.java @@ -165,7 +165,7 @@ public class LauncherActivity extends BaseActivity { ExtraCore.addExtraListener(ExtraConstants.LAUNCH_GAME, mLaunchGameListener); - new AsyncVersionList().getVersionList(versions -> ExtraCore.setValue(ExtraConstants.RELEASE_TABLE, versions)); + new AsyncVersionList().getVersionList(versions -> ExtraCore.setValue(ExtraConstants.RELEASE_TABLE, versions), false); mProgressLayout.observe(ProgressLayout.DOWNLOAD_MINECRAFT); mProgressLayout.observe(ProgressLayout.UNPACK_RUNTIME); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncVersionList.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncVersionList.java index 02f0dc0af..0a18ac0fb 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncVersionList.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncVersionList.java @@ -7,6 +7,8 @@ import android.util.Log; import androidx.annotation.Nullable; +import com.google.gson.JsonIOException; +import com.google.gson.JsonSyntaxException; import com.google.gson.stream.JsonReader; import net.kdt.pojavlaunch.JMinecraftVersionList; @@ -22,7 +24,7 @@ import java.io.IOException; /** Class getting the version list, and that's all really */ public class AsyncVersionList { - public void getVersionList(@Nullable VersionDoneListener listener){ + public void getVersionList(@Nullable VersionDoneListener listener, boolean secondPass){ sExecutorService.execute(() -> { File versionFile = new File(Tools.DIR_DATA + "/version_list.json"); JMinecraftVersionList versionList = null; @@ -41,6 +43,11 @@ public class AsyncVersionList { versionList = Tools.GLOBAL_GSON.fromJson(new JsonReader(new FileReader(versionFile)), JMinecraftVersionList.class); } catch (FileNotFoundException e) { e.printStackTrace(); + } catch (JsonIOException | JsonSyntaxException e) { + e.printStackTrace(); + versionFile.delete(); + if(!secondPass) + getVersionList(listener, true); } }