mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 16:16:04 -04:00
Ensure that the profile map is never null
Do not let the user launch the game if the version id is "Unknown"
This commit is contained in:
parent
a768f22dda
commit
7c3aacd2af
@ -106,13 +106,12 @@ public class LauncherActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
String selectedProfile = LauncherPreferences.DEFAULT_PREF.getString(LauncherPreferences.PREF_KEY_CURRENT_PROFILE,"");
|
||||
if (LauncherProfiles.mainProfileJson == null || LauncherProfiles.mainProfileJson.profiles == null
|
||||
|| !LauncherProfiles.mainProfileJson.profiles.containsKey(selectedProfile)){
|
||||
if (LauncherProfiles.mainProfileJson == null || !LauncherProfiles.mainProfileJson.profiles.containsKey(selectedProfile)){
|
||||
Toast.makeText(this, R.string.error_no_version, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(selectedProfile);
|
||||
if (prof == null || prof.lastVersionId == null){
|
||||
if (prof == null || prof.lastVersionId == null || "Unknown".equals(prof.lastVersionId)){
|
||||
Toast.makeText(this, R.string.error_no_version, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public class LauncherProfiles {
|
||||
if (mainProfileJson == null) {
|
||||
if (launcherProfilesFile.exists()) {
|
||||
mainProfileJson = Tools.GLOBAL_GSON.fromJson(Tools.read(launcherProfilesFile.getAbsolutePath()), MinecraftLauncherProfiles.class);
|
||||
if(mainProfileJson.profiles == null) mainProfileJson.profiles = new HashMap<>();
|
||||
} else {
|
||||
mainProfileJson = new MinecraftLauncherProfiles();
|
||||
mainProfileJson.profiles = new HashMap<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user