Only update SMS setting if registration is complete.

Otherwise you could crash during registration if the user had previously
set Signal as the default.
This commit is contained in:
Greyson Parrelli 2021-05-12 17:15:59 -04:00
parent 70db617229
commit 45d010bdb6

View file

@ -359,7 +359,7 @@ public final class SettingsValues extends SignalStoreValues {
public void setDefaultSms(boolean value) {
boolean lastKnown = getBoolean(DEFAULT_SMS, false);
if (value != lastKnown) {
if (value != lastKnown && SignalStore.registrationValues().isRegistrationComplete()) {
Log.i(TAG, "Default SMS state changed! Scheduling a storage sync.");
putBoolean(DEFAULT_SMS, value);