Prevent crash

pull/156/head
M66B 7 years ago
parent f439458899
commit 04a2a12546

@ -134,8 +134,12 @@ public class ServiceSynchronize extends LifecycleService {
@Override @Override
public void onChanged(@Nullable TupleAccountStats stats) { public void onChanged(@Nullable TupleAccountStats stats) {
if (stats != null && !stats.equals(lastStats)) { if (stats != null && !stats.equals(lastStats)) {
try {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(Helper.NOTIFICATION_SYNCHRONIZE, getNotificationService(stats).build()); nm.notify(Helper.NOTIFICATION_SYNCHRONIZE, getNotificationService(stats).build());
} catch (Throwable ex) {
Log.e(ex);
}
if (oneshot && stats.operations > 0) if (oneshot && stats.operations > 0)
onOneshot(true); onOneshot(true);
@ -163,7 +167,11 @@ public class ServiceSynchronize extends LifecycleService {
@Override @Override
public void onChanged(List<TupleMessageEx> messages) { public void onChanged(List<TupleMessageEx> messages) {
try {
Core.notifyMessages(ServiceSynchronize.this, notifying, messages); Core.notifyMessages(ServiceSynchronize.this, notifying, messages);
} catch (Throwable ex) {
Log.e(ex);
}
} }
}); });

Loading…
Cancel
Save