1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

Change log view: be more defensive about malformed dates for events.

This commit is contained in:
Tom Hacohen 2020-10-27 08:26:49 +02:00
parent 37c40ddbce
commit 5cd8ea82ff
2 changed files with 14 additions and 2 deletions

View File

@ -264,7 +264,13 @@ class JournalItemActivity : BaseActivity(), Refreshable {
setTextViewText(view, R.id.title, event.summary) setTextViewText(view, R.id.title, event.summary)
setTextViewText(view, R.id.when_datetime, getDisplayedDatetime(event.dtStart?.date?.time!!, event.dtEnd?.date!!.time, event.isAllDay(), context)) val dtStart = event.dtStart?.date?.time
val dtEnd = event.dtEnd?.date?.time
if ((dtStart == null) || (dtEnd == null)) {
setTextViewText(view, R.id.when_datetime, getString(R.string.loading_error_title))
} else {
setTextViewText(view, R.id.when_datetime, getDisplayedDatetime(dtStart, dtEnd, event.isAllDay(), context))
}
setTextViewText(view, R.id.where, event.location) setTextViewText(view, R.id.where, event.location)

View File

@ -251,7 +251,13 @@ class PrettyFragment(private val mainFragment: CollectionItemFragment, private v
setTextViewText(view, R.id.title, event.summary) setTextViewText(view, R.id.title, event.summary)
setTextViewText(view, R.id.when_datetime, getDisplayedDatetime(event.dtStart?.date?.time!!, event.dtEnd?.date!!.time, event.isAllDay(), context)) val dtStart = event.dtStart?.date?.time
val dtEnd = event.dtEnd?.date?.time
if ((dtStart == null) || (dtEnd == null)) {
setTextViewText(view, R.id.when_datetime, getString(R.string.loading_error_title))
} else {
setTextViewText(view, R.id.when_datetime, getDisplayedDatetime(dtStart, dtEnd, event.isAllDay(), context))
}
setTextViewText(view, R.id.where, event.location) setTextViewText(view, R.id.where, event.location)