From 495f8c56b1413360aacc8c55b6f8764c02548620 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 8 Oct 2017 19:15:34 +0200 Subject: [PATCH] check if the latest used calendar id is still valid --- .../simplemobiletools/calendar/activities/EventActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index cbc3a4057..0bf39c7a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -136,7 +136,9 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { val addHours = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) 1 else 0 mEventEndDateTime = mEventStartDateTime.plusHours(addHours) - mEventCalendarId = config.lastUsedCaldavCalendar + + val isLastCaldavCalendarOK = config.caldavSync && config.getSyncedCalendarIdsAsList().contains(config.lastUsedCaldavCalendar.toString()) + mEventCalendarId = if (isLastCaldavCalendarOK) config.lastUsedCaldavCalendar else STORED_LOCALLY_ONLY } private fun showReminder1Dialog() {