Check to make sure local task is non-null when saving during gtasks sync

pull/14/head
Sam Bosley 13 years ago
parent 7a731a190a
commit efa502be7d

@ -258,9 +258,13 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
// merge astrid dates with google dates // merge astrid dates with google dates
if(task.task.isSaved()) { if(task.task.isSaved()) {
Task local = PluginServices.getTaskService().fetchById(task.task.getId(), Task.DUE_DATE, Task.COMPLETION_DATE); Task local = PluginServices.getTaskService().fetchById(task.task.getId(), Task.DUE_DATE, Task.COMPLETION_DATE);
mergeDates(task.task, local); if (local == null) {
if(task.task.isCompleted() && !local.isCompleted()) task.task.clearValue(Task.ID);
StatisticsService.reportEvent(StatisticsConstants.GTASKS_TASK_COMPLETED); } 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 } else { // Set default reminders for remotely created tasks
TaskDao.setDefaultReminders(task.task); TaskDao.setDefaultReminders(task.task);
} }

Loading…
Cancel
Save