diff options
author | desperateCoder <echotodevnull@gmail.com> | 2020-07-26 15:34:58 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2020-07-26 15:35:08 +0300 |
commit | 27451b4a5042999e1e3e577db47753ce3075f078 (patch) | |
tree | 31e224d2957a11948e71cd2fedd2d6121ababed6 /app/src | |
parent | 187d9acc34afdf36b6e6e988bc350e6975a51d2a (diff) |
#628 check for null in findDelta
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java index 166d6c519..d43550729 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/providers/AbstractSyncDataProvider.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.api.IResponseCallback; import it.niedermann.nextcloud.deck.model.interfaces.IRemoteEntity; import it.niedermann.nextcloud.deck.persistence.sync.adapters.ServerAdapter; @@ -39,9 +40,17 @@ public abstract class AbstractSyncDataProvider<T extends IRemoteEntity> { public static <T extends IRemoteEntity> List<T> findDelta(List<T> listA, List<T> listB){ List<T> delta = new ArrayList<>(); for (T b : listB) { + if (b == null) { + DeckLog.error("Entry in listB is null! skipping..."); + continue; + } boolean found = false; for (T a : listA) { - if ((a.getLocalId()!= null && b.getLocalId()!= null ? (a.getLocalId().equals(b.getLocalId())) + if (a == null) { + DeckLog.error("Entry in listA is null! skipping..."); + continue; + } + if ((a.getLocalId() != null && b.getLocalId() != null ? (a.getLocalId().equals(b.getLocalId())) : a.getId().equals(b.getId())) && b.getAccountId() == a.getAccountId()) { found = true; break; |