One-liner: fix profiles being sometimes null

This commit is contained in:
artdeell 2022-05-26 19:19:07 +03:00
parent 3c845e6855
commit f52b4ed0f1

View File

@ -81,6 +81,7 @@ public class BaseMainActivity extends BaseActivity {
mControlLayout = findViewById(R.id.main_control_layout); mControlLayout = findViewById(R.id.main_control_layout);
mProfile = PojavProfile.getCurrentProfileContent(this); mProfile = PojavProfile.getCurrentProfileContent(this);
LauncherProfiles.update();
minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(LauncherPreferences.DEFAULT_PREF.getString(LauncherPreferences.PREF_KEY_CURRENT_PROFILE,"")); minecraftProfile = LauncherProfiles.mainProfileJson.profiles.get(LauncherPreferences.DEFAULT_PREF.getString(LauncherPreferences.PREF_KEY_CURRENT_PROFILE,""));
if(minecraftProfile == null) { if(minecraftProfile == null) {
Toast.makeText(this,"Attempted to launch nonexistent profile",Toast.LENGTH_SHORT).show(); Toast.makeText(this,"Attempted to launch nonexistent profile",Toast.LENGTH_SHORT).show();
@ -88,7 +89,6 @@ public class BaseMainActivity extends BaseActivity {
return; return;
} }
String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME; String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME;
LauncherProfiles.update();
mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId( mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId(
minecraftProfile.lastVersionId)); minecraftProfile.lastVersionId));