From e6cb93c57d4a52b59e67d638e4df211443c2aaa6 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 15 Jul 2024 16:18:56 -0500 Subject: [PATCH] Fix crash in vtodo cache migration --- app/src/main/java/org/tasks/db/Migrations.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/tasks/db/Migrations.kt b/app/src/main/java/org/tasks/db/Migrations.kt index eadafbc83..866477836 100644 --- a/app/src/main/java/org/tasks/db/Migrations.kt +++ b/app/src/main/java/org/tasks/db/Migrations.kt @@ -21,6 +21,7 @@ import org.tasks.data.entity.Task import org.tasks.data.entity.Task.Companion.NOTIFY_AFTER_DEADLINE import org.tasks.data.entity.Task.Companion.NOTIFY_AT_DEADLINE import org.tasks.data.entity.Task.Companion.NOTIFY_AT_START +import org.tasks.data.getTextOrNull import org.tasks.preferences.DefaultFilterProvider import org.tasks.preferences.Preferences import org.tasks.repeats.RecurrenceUtils.newRecur @@ -458,14 +459,14 @@ object Migrations { .use { while (it.step()) { val file = fileStorage.getFile( - it.getText(0), - it.getText(1), + it.getTextOrNull(0), + it.getTextOrNull(1), ) ?.apply { mkdirs() } ?: continue - if (it.isNull(2)) continue - val `object` = it.getText(2) - fileStorage.write(File(file, `object`), it.getText(3)) + val `object` = it.getTextOrNull(2) ?: continue + val data = it.getTextOrNull(3) ?: continue + fileStorage.write(File(file, `object`), data) } } connection.execSQL("ALTER TABLE `caldav_tasks` RENAME TO `caldav_tasks-temp`")