Don't crash EteSync sync on iCal parse failure

pull/996/head
Alex Baker 5 years ago
parent 84e48390be
commit 556562c97e

@ -46,8 +46,15 @@ class iCalendar @Inject constructor(
}
fun fromVtodo(vtodo: String): Task? {
try {
val tasks = tasksFromReader(StringReader(vtodo))
return if (tasks.size == 1) tasks[0] else null
if (tasks.size == 1) {
return tasks[0]
}
} catch (e: Exception) {
Timber.e(e)
}
return null
}
fun getParent(remote: Task): String? {

@ -237,6 +237,9 @@ public class EteSynchronizer {
String vtodo = syncEntry.getContent();
Timber.v("%s: %s", action, vtodo);
at.bitfire.ical4android.Task task = iCalendar.Companion.fromVtodo(vtodo);
if (task == null) {
continue;
}
String remoteId = task.getUid();
CaldavTask caldavTask = caldavDao.getTaskByRemoteId(caldavCalendar.getUuid(), remoteId);
switch (action) {

Loading…
Cancel
Save