mirror of
https://github.com/etesync/android
synced 2025-03-15 23:16:06 +00:00
Workaround: ignore invalid account errors when syncing contacts
This is an ugly workaround. For some reason a sync is called when an account is removed. Since the main account is removed, we get an invalid account exception when trying to fetch it. Need to find out why a sync is even triggered and just remove it there.
This commit is contained in:
parent
c81ba0cddb
commit
aeae7de077
@ -33,6 +33,7 @@ import com.etesync.syncadapter.ui.DebugInfoActivity;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import at.bitfire.vcard4android.ContactsStorageException;
|
||||
import io.requery.Persistable;
|
||||
import io.requery.sql.EntityDataStore;
|
||||
import okhttp3.HttpUrl;
|
||||
@ -62,7 +63,15 @@ public class ContactsSyncAdapterService extends SyncAdapterService {
|
||||
try {
|
||||
LocalAddressBook addressBook = new LocalAddressBook(getContext(), account, provider);
|
||||
|
||||
AccountSettings settings = new AccountSettings(getContext(), addressBook.getMainAccount());
|
||||
AccountSettings settings;
|
||||
try {
|
||||
settings = new AccountSettings(getContext(), addressBook.getMainAccount());
|
||||
} catch (InvalidAccountException|ContactsStorageException e) {
|
||||
App.log.info("Skipping sync due to invalid account.");
|
||||
App.log.info(e.getLocalizedMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!extras.containsKey(ContentResolver.SYNC_EXTRAS_MANUAL) && !checkSyncConditions(settings))
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user