diff --git a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java index 8687d089b8b6ef6803b1374de3990296f8d0b2f0..90dc0384e8378cc1080a4e8b2f7aff4d9c0fb7e8 100644 --- a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java +++ b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java @@ -257,7 +257,10 @@ public abstract class BaseSetupWizardActivity extends AppCompatActivity implemen } setResult(resultCode, data); Intent intent = WizardManagerHelper.getNextIntent(getIntent(), resultCode, data); - mNextIntentResultLauncher.launch(intent); + // Ensure the ActivityResultLauncher is registered before using it + if (mNextIntentResultLauncher != null) { + mNextIntentResultLauncher.launch(intent); + } } /** Adorn the Intent with Setup Wizard-related extras. */ diff --git a/src/org/lineageos/setupwizard/SubBaseActivity.java b/src/org/lineageos/setupwizard/SubBaseActivity.java index fe6ab12fbe4ac44728119c1ef78f0f1019115d9a..706b6573d89c623ef3905c826b876772d7772187 100644 --- a/src/org/lineageos/setupwizard/SubBaseActivity.java +++ b/src/org/lineageos/setupwizard/SubBaseActivity.java @@ -73,7 +73,10 @@ public abstract class SubBaseActivity extends BaseSetupWizardActivity { subactivityIntent.putExtra(EXTRA_WIZARD_BUNDLE, wizardBundle); } try { - mSubactivityResultLauncher.launch(subactivityIntent); + // Ensure the ActivityResultLauncher is registered before using it + if (mSubactivityResultLauncher != null) { + mSubactivityResultLauncher.launch(subactivityIntent); + } } catch (ActivityNotFoundException e) { Log.w(TAG, "activity not found; start next screen and finish; intent=" + intent); mIsSubactivityNotFound = true;