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

View file

@ -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