make date converter null safe (#3006)
This commit is contained in:
parent
48ad2f9eee
commit
864e72d6f3
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue