From 73c75a9b347a76fe9cadf4bf3529844198b70d2a Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 28 Nov 2017 14:33:22 -0800 Subject: [PATCH] Don't delete GCM id during registration if it never existed Fixes #7229 --- src/org/thoughtcrime/securesms/RegistrationActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java index f02220bd8e..d25f3324f0 100644 --- a/src/org/thoughtcrime/securesms/RegistrationActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java @@ -355,7 +355,10 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif SignedPreKeyRecord signedPreKey = PreKeyUtil.generateSignedPreKey(RegistrationActivity.this, identityKey, true); accountManager.setPreKeys(identityKey.getPublicKey(), signedPreKey, records); - accountManager.setGcmId(registrationState.gcmToken); + + if (registrationState.gcmToken.isPresent()) { + accountManager.setGcmId(registrationState.gcmToken); + } TextSecurePreferences.setGcmRegistrationId(RegistrationActivity.this, registrationState.gcmToken.orNull()); TextSecurePreferences.setGcmDisabled(RegistrationActivity.this, !registrationState.gcmToken.isPresent());