From 1ff17fc3f09d91a8a222114b5c566d427f3e6a8c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 6 Aug 2019 15:04:59 +0200 Subject: [PATCH] catch more firebase library bugs --- .../conversations/services/PushManagementService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java index 1fc8e58fe..e99de1b14 100644 --- a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java +++ b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java @@ -147,7 +147,14 @@ public class PushManagementService { } private void retrieveFcmInstanceToken(final OnGcmInstanceTokenRetrieved instanceTokenRetrieved) { - FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(task -> { + final FirebaseInstanceId firebaseInstanceId; + try { + firebaseInstanceId = FirebaseInstanceId.getInstance(); + } catch (IllegalStateException e) { + Log.d(Config.LOGTAG, "unable to get firebase instance token ",e); + return; + } + firebaseInstanceId.getInstanceId().addOnCompleteListener(task -> { if (!task.isSuccessful()) { Log.d(Config.LOGTAG, "unable to get Firebase instance token", task.getException()); }