From fec4c77af3133d4d32e6b51ef417371c125b6a15 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 23 Feb 2012 15:18:18 -0800 Subject: [PATCH] Sanity check for 0 when receiving remote task ids --- .../com/todoroo/astrid/actfm/sync/ActFmSyncService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index 48a348b4a..26262f800 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -1210,7 +1210,11 @@ public final class ActFmSyncService { public static void taskFromJson(JSONObject json, Task model, ArrayList metadata) throws JSONException { metadata.clear(); model.clearValue(Task.REMOTE_ID); - model.setValue(Task.REMOTE_ID, json.getLong("id")); + long remoteId = json.getLong("id"); + if (remoteId == 0) + model.setValue(Task.REMOTE_ID, null); + else + model.setValue(Task.REMOTE_ID, remoteId); readUser(json.getJSONObject("user"), model, Task.USER_ID, Task.USER); readUser(json.getJSONObject("creator"), model, Task.CREATOR_ID, null); model.setValue(Task.TITLE, json.getString("title"));