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