diff options
author | desperateCoder <echotodevnull@gmail.com> | 2020-10-04 17:45:07 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2020-10-04 17:45:07 +0300 |
commit | eb4f816bf3ef32a1f1ae7215025d2727fc78982d (patch) | |
tree | 0c7c00251ec29f88d90f44714299bf39c9c825a2 /app/src/main/java/it/niedermann/nextcloud/deck/persistence | |
parent | 28db51968682a2ec7ae905bc3c0c4b66f04cc18a (diff) |
#687 fixed another npe
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/persistence')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/DataPropagationHelper.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/DataPropagationHelper.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/DataPropagationHelper.java index feee8cfa6..782b6d951 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/DataPropagationHelper.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/helpers/DataPropagationHelper.java @@ -106,23 +106,28 @@ public class DataPropagationHelper { provider.deleteInDB(dataBaseAdapter, accountId, entity); boolean connected = serverAdapter.hasInternetConnection(); if (entity.getId() != null && connected) { - provider.deleteOnServer(serverAdapter, accountId, new IResponseCallback<Void>(new Account(accountId)) { - @Override - public void onResponse(Void response) { - new Thread(() -> { - provider.deletePhysicallyInDB(dataBaseAdapter, accountId, entity); - callback.onResponse(null); - }).start(); - } + try { + provider.deleteOnServer(serverAdapter, accountId, new IResponseCallback<Void>(new Account(accountId)) { + @Override + public void onResponse(Void response) { + new Thread(() -> { + provider.deletePhysicallyInDB(dataBaseAdapter, accountId, entity); + callback.onResponse(null); + }).start(); + } + + @Override + public void onError(Throwable throwable) { + super.onError(throwable); + new Thread(() -> { + callback.onError(throwable); + }).start(); + } + }, entity, dataBaseAdapter); + } catch (Throwable t) { + callback.onError(t); + } - @Override - public void onError(Throwable throwable) { - super.onError(throwable); - new Thread(() -> { - callback.onError(throwable); - }).start(); - } - }, entity, dataBaseAdapter); } else { callback.onResponse(null); } |