diff options
author | desperateCoder <echotodevnull@gmail.com> | 2022-10-02 10:14:34 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2022-10-02 10:14:34 +0300 |
commit | d5149bdf881f1351d8bb43d5021723ffe9795fa6 (patch) | |
tree | 5d2924315d772cc9f0dbce7199c5a056f8035ee6 /app/src/main/java/it/niedermann | |
parent | 859e3ccdec6365b3c99251ec075819081884dc03 (diff) |
#1337 fix NPE
Diffstat (limited to 'app/src/main/java/it/niedermann')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/api/JsonToEntityParser.java | 6 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/api/JsonToEntityParser.java b/app/src/main/java/it/niedermann/nextcloud/deck/api/JsonToEntityParser.java index c049c1fac..946482c0c 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/api/JsonToEntityParser.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/api/JsonToEntityParser.java @@ -450,7 +450,7 @@ public class JsonToEntityParser { card.setOrder(0); } - card.setOverdue(e.get("overdue").getAsInt()); + card.setOverdue(getNullAsZero(e.get("overdue"))); card.setDueDate(getTimestampFromString(e.get("duedate"))); card.setCommentsUnread(e.get("commentsUnread").getAsInt()); JsonElement owner = e.get("owner"); @@ -669,6 +669,10 @@ public class JsonToEntityParser { return jsonElement == null || jsonElement.isJsonNull() ? null : jsonElement.getAsString(); } + private static int getNullAsZero(JsonElement jsonElement) { + return jsonElement == null || jsonElement.isJsonNull() ? 0 : jsonElement.getAsInt(); + } + private static Instant getTimestampFromString(JsonElement jsonElement) { if (jsonElement == null || jsonElement.isJsonNull()) { return null; diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java index c0500eb12..22a9b322e 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java @@ -20,6 +20,9 @@ public interface CardDao extends GenericDao<Card> { "join stack s on s.localId = c.stackId " + "join board b on b.localId = s.boardId " + "WHERE b.archived = 0 and c.archived = 0 and b.status <> 3 and s.status <> 3 and c.status <> 3 " + + "and (c.deletedAt is null or c.deletedAt = 0) " + + "and (s.deletedAt is null or s.deletedAt = 0) " + + "and (b.deletedAt is null or b.deletedAt = 0) " + // FUll Logic: (hasDueDate AND isIn_PRIVATE_Board) OR (isInSharedBoard AND (assignedToMe OR (hasDueDate AND noAssignees))) "and (" + "(c.dueDate is not null AND NOT exists(select 1 from AccessControl ac where ac.boardId = b.localId and ac.status <> 3))" + //(hasDueDate AND isInPrivateBoard) |