diff options
author | desperateCoder <echotodevnull@gmail.com> | 2021-02-07 17:04:46 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2021-02-07 17:04:56 +0300 |
commit | 2bbc50657f61de140cdeda5e294ee51fd72f9d41 (patch) | |
tree | cdc6d07b1d821c59c670fe402aaf830c31726c2b /app | |
parent | df2951d661de4402c26a74f92c1f59130916254b (diff) |
fixes #824 - added fallback for non-arrays
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/api/NextcloudArrayDeserializer.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/api/NextcloudArrayDeserializer.java b/app/src/main/java/it/niedermann/nextcloud/deck/api/NextcloudArrayDeserializer.java index 820cfc653..1e99c8817 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/api/NextcloudArrayDeserializer.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/api/NextcloudArrayDeserializer.java @@ -35,8 +35,14 @@ public class NextcloudArrayDeserializer<T> implements JsonDeserializer<List<T>> JsonObject obj = jArr.get(i).getAsJsonObject(); items.add(JsonToEntityParser.parseJsonObject(obj, mType)); } + } else if (json.isJsonObject()) { + try { + items.add(JsonToEntityParser.parseJsonObject(json.getAsJsonObject(), mType)); + } catch (Exception e) { + throw new IllegalArgumentException("NextcloudArrayDeserializer got a Json Object, fallback parsing failed for input: " + json); + } } else { - throw new IllegalArgumentException("NextcloudArrayDeserializer got an non-array Json Object: " + json); + throw new IllegalArgumentException("NextcloudArrayDeserializer got a malformed Json Object: " + json); } return items; |