Commit b69d908b authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add null check to Gcm registration model

parent 10d6196c
...@@ -65,7 +65,10 @@ public class GcmPushRegistrationObserver extends AbstractModelObserver<GcmPushRe ...@@ -65,7 +65,10 @@ public class GcmPushRegistrationObserver extends AbstractModelObserver<GcmPushRe
).continueWith(task -> { ).continueWith(task -> {
if (task.isFaulted()) { if (task.isFaulted()) {
realmHelper.executeTransaction(realm -> { realmHelper.executeTransaction(realm -> {
GcmPushRegistration.queryDefault(realm).findFirst().setSyncState(SyncState.FAILED); GcmPushRegistration gcmPushRegistration = GcmPushRegistration.queryDefault(realm).findFirst();
if (gcmPushRegistration != null) {
gcmPushRegistration.setSyncState(SyncState.FAILED);
}
return null; return null;
}).continueWith(new LogIfError()); }).continueWith(new LogIfError());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment