From aa25ce1659cac3203cf009731a0a5d7254c70f69 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 08:27:22 +0200 Subject: [PATCH] adding some crashfixes --- .../calendar/activities/ManageEventTypesActivity.kt | 2 +- .../kotlin/com/simplemobiletools/calendar/models/Event.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt index 46f08d2b6..d705d8dfe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/ManageEventTypesActivity.kt @@ -25,7 +25,7 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteEventTypesListener { } private fun showEventTypeDialog(eventType: EventType? = null) { - UpdateEventTypeDialog(this, eventType!!.copy()) { + UpdateEventTypeDialog(this, eventType?.copy()) { getEventTypes() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt index 5a9c295d2..6148dad3c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt @@ -104,7 +104,7 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var } } - fun getCalDAVEventId() = (importId.split("-").lastOrNull() ?: "0").toString().toLong() + fun getCalDAVEventId() = if (importId.contains("-")) (importId.split("-").lastOrNull() ?: "0").toString().toLong() else 0L - fun getCalDAVCalendarId() = (source.split("-").lastOrNull() ?: "0").toString().toInt() + fun getCalDAVCalendarId() = if (source.contains("-")) (source.split("-").lastOrNull() ?: "0").toString().toInt() else 0 }