addig a null check
This commit is contained in:
parent
01c370ca68
commit
e5a23c74d1
|
@ -25,17 +25,17 @@ import kotlin.collections.ArrayList
|
||||||
class CalDAVHandler(val context: Context) {
|
class CalDAVHandler(val context: Context) {
|
||||||
fun refreshCalendars(activity: SimpleActivity? = null, callback: () -> Unit) {
|
fun refreshCalendars(activity: SimpleActivity? = null, callback: () -> Unit) {
|
||||||
val dbHelper = context.dbHelper
|
val dbHelper = context.dbHelper
|
||||||
getCalDAVCalendars(activity, context.config.caldavSyncedCalendarIDs).forEach {
|
for (calendar in getCalDAVCalendars(activity, context.config.caldavSyncedCalendarIDs)) {
|
||||||
val localEventType = dbHelper.getEventTypeWithCalDAVCalendarId(it.id)
|
val localEventType = dbHelper.getEventTypeWithCalDAVCalendarId(calendar.id) ?: continue
|
||||||
localEventType?.apply {
|
localEventType.apply {
|
||||||
title = it.displayName
|
title = calendar.displayName
|
||||||
caldavDisplayName = it.displayName
|
caldavDisplayName = calendar.displayName
|
||||||
caldavEmail = it.accountName
|
caldavEmail = calendar.accountName
|
||||||
color = it.color
|
color = calendar.color
|
||||||
dbHelper.updateLocalEventType(this)
|
dbHelper.updateLocalEventType(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
CalDAVHandler(context).fetchCalDAVCalendarEvents(it.id, localEventType!!.id, activity)
|
CalDAVHandler(context).fetchCalDAVCalendarEvents(calendar.id, localEventType.id, activity)
|
||||||
}
|
}
|
||||||
context.scheduleCalDAVSync(true)
|
context.scheduleCalDAVSync(true)
|
||||||
callback()
|
callback()
|
||||||
|
|
Loading…
Reference in New Issue