From 864e72d6f3fd008609a3d9c276f41b7890f80a2b Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Tue, 6 Dec 2022 20:32:12 +0100 Subject: [PATCH] make date converter null safe (#3006) --- .../main/java/com/keylesspalace/tusky/db/Converters.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt b/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt index 34ff6474..d211eb49 100644 --- a/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt +++ b/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt @@ -126,13 +126,13 @@ class Converters @Inject constructor ( } @TypeConverter - fun dateToLong(date: Date): Long { - return date.time + fun dateToLong(date: Date?): Long? { + return date?.time } @TypeConverter - fun longToDate(date: Long): Date { - return Date(date) + fun longToDate(date: Long?): Date? { + return date?.let { Date(it) } } @TypeConverter