make date converter null safe (#3006)

This commit is contained in:
Konrad Pozniak 2022-12-06 20:32:12 +01:00 committed by GitHub
parent 48ad2f9eee
commit 864e72d6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -126,13 +126,13 @@ class Converters @Inject constructor (
} }
@TypeConverter @TypeConverter
fun dateToLong(date: Date): Long { fun dateToLong(date: Date?): Long? {
return date.time return date?.time
} }
@TypeConverter @TypeConverter
fun longToDate(date: Long): Date { fun longToDate(date: Long?): Date? {
return Date(date) return date?.let { Date(it) }
} }
@TypeConverter @TypeConverter