From efa502be7d307802f007f26d59f282e38c411af0 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 15 Feb 2012 13:30:45 -0800 Subject: [PATCH] Check to make sure local task is non-null when saving during gtasks sync --- .../astrid/gtasks/sync/GtasksSyncV2Provider.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java index 759575600..c6fb19400 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java @@ -258,9 +258,13 @@ public class GtasksSyncV2Provider extends SyncV2Provider { // merge astrid dates with google dates if(task.task.isSaved()) { Task local = PluginServices.getTaskService().fetchById(task.task.getId(), Task.DUE_DATE, Task.COMPLETION_DATE); - mergeDates(task.task, local); - if(task.task.isCompleted() && !local.isCompleted()) - StatisticsService.reportEvent(StatisticsConstants.GTASKS_TASK_COMPLETED); + if (local == null) { + task.task.clearValue(Task.ID); + } else { + mergeDates(task.task, local); + if(task.task.isCompleted() && !local.isCompleted()) + StatisticsService.reportEvent(StatisticsConstants.GTASKS_TASK_COMPLETED); + } } else { // Set default reminders for remotely created tasks TaskDao.setDefaultReminders(task.task); }