Prevent some crash loops.

This commit is contained in:
Greyson Parrelli 2020-04-23 22:25:41 -04:00
parent 7db288b9aa
commit 5193a5d309
3 changed files with 9 additions and 2 deletions

View File

@ -100,6 +100,10 @@ public class MmsDownloadJob extends BaseJob {
@Override @Override
public void onRun() { public void onRun() {
if (TextSecurePreferences.getLocalUuid(context) == null && TextSecurePreferences.getLocalNumber(context) == null) {
throw new NotReadyException();
}
MmsDatabase database = DatabaseFactory.getMmsDatabase(context); MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
Optional<MmsDatabase.MmsNotificationInfo> notification = database.getNotification(messageId); Optional<MmsDatabase.MmsNotificationInfo> notification = database.getNotification(messageId);
@ -265,4 +269,7 @@ public class MmsDownloadJob extends BaseJob {
data.getBoolean(KEY_AUTOMATIC)); data.getBoolean(KEY_AUTOMATIC));
} }
} }
private static class NotReadyException extends RuntimeException {
}
} }

View File

@ -49,7 +49,7 @@ public class RefreshAttributesJob extends BaseJob {
@Override @Override
public void onRun() throws IOException { public void onRun() throws IOException {
if (!TextSecurePreferences.isPushRegistered(context)) { if (!TextSecurePreferences.isPushRegistered(context) || TextSecurePreferences.getLocalNumber(context) == null) {
Log.w(TAG, "Not yet registered. Skipping."); Log.w(TAG, "Not yet registered. Skipping.");
return; return;
} }

View File

@ -170,6 +170,6 @@ public class SmsReceiveJob extends BaseJob {
} }
} }
private class NotReadyException extends RuntimeException { private static class NotReadyException extends RuntimeException {
} }
} }