diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java index e0e283cf7..9e9d0ca5d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java @@ -91,6 +91,7 @@ public final class GtasksMetadataService extends SyncMetadataService match = taskService.query(Query.select(Task.ID) + TodorooCursor match = taskService.query(Query.select(Task.ID, Task.UUID) .join(Join.left(Metadata.TABLE, Criterion.and(Metadata.KEY.eq(GtasksMetadata.METADATA_KEY), Metadata.TASK.eq(Task.ID)))) .where(Criterion.and(Task.TITLE.eq(title), GtasksMetadata.ID.isNull()))); try { if (match.getCount() > 0) { match.moveToFirst(); task.setId(match.get(Task.ID)); + task.setUuid(match.get(Task.UUID)); } } finally { match.close(); diff --git a/astrid/src/com/todoroo/astrid/dao/RemoteModelDao.java b/astrid/src/com/todoroo/astrid/dao/RemoteModelDao.java index 1e2d61310..c014a9ddc 100644 --- a/astrid/src/com/todoroo/astrid/dao/RemoteModelDao.java +++ b/astrid/src/com/todoroo/astrid/dao/RemoteModelDao.java @@ -25,7 +25,7 @@ public class RemoteModelDao extends DatabaseDao extends DatabaseDao cursor = query(Query.select(RemoteModel.UUID_PROPERTY).where(AbstractModel.ID_PROPERTY.eq(localId))); + try { + if (cursor.getCount() == 0) + return RemoteModel.NO_UUID; + cursor.moveToFirst(); + return cursor.get(RemoteModel.UUID_PROPERTY); + } finally { + cursor.close(); + } + } + }