From e317b11c5770cb480bb2610bea28471b71a142c6 Mon Sep 17 00:00:00 2001 From: Lode Hoste Date: Wed, 6 May 2015 07:59:48 +0200 Subject: [PATCH] Catch missing json field (fixes #291) --- .../com/nutomic/syncthingandroid/syncthing/RestApi.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java index 2f6bbabf..c998182d 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java @@ -519,7 +519,11 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener, Folder r = new Folder(); r.path = json.getString("path"); r.id = json.getString("id"); - r.invalid = json.getString("invalid"); + if (json.has("invalid")) { + r.invalid = json.getString("invalid"); // TODO Upstream bug + } else { + r.invalid = ""; + } r.deviceIds = new ArrayList<>(); JSONArray devices = json.getJSONArray("devices"); for (int j = 0; j < devices.length(); j++) {