fixing some crashes with naive try/catch blocks
This commit is contained in:
parent
7e63bc8821
commit
948a99a5d5
|
@ -145,7 +145,12 @@ class CalDAVHelper(val context: Context) {
|
|||
private fun fetchCalDAVCalendarEvents(calendarId: Int, eventTypeId: Long, showToasts: Boolean) {
|
||||
val importIdsMap = HashMap<String, Event>()
|
||||
val fetchedEventIds = ArrayList<String>()
|
||||
val existingEvents = context.eventsDB.getEventsFromCalDAVCalendar("$CALDAV-$calendarId")
|
||||
val existingEvents = try {
|
||||
context.eventsDB.getEventsFromCalDAVCalendar("$CALDAV-$calendarId")
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
|
||||
existingEvents.forEach {
|
||||
importIdsMap[it.importId] = it
|
||||
}
|
||||
|
|
|
@ -16,7 +16,11 @@ class Converters {
|
|||
value
|
||||
}
|
||||
|
||||
return gson.fromJson(newValue, stringType)
|
||||
return try {
|
||||
gson.fromJson(newValue, stringType)
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
|
|
|
@ -248,7 +248,11 @@ class EventsHelper(val context: Context) {
|
|||
callback(ArrayList())
|
||||
return
|
||||
} else {
|
||||
eventsDB.getOneTimeEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event>
|
||||
try {
|
||||
eventsDB.getOneTimeEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event>
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (eventId == -1L) {
|
||||
|
|
|
@ -86,7 +86,11 @@ data class Event(
|
|||
|
||||
while (newDateTime.dayOfMonth().maximumValue < Formatter.getDateTimeFromTS(original.startTS).dayOfMonth().maximumValue) {
|
||||
newDateTime = newDateTime.plusMonths(repeatInterval / MONTH)
|
||||
newDateTime = newDateTime.withDayOfMonth(currStart.dayOfMonth)
|
||||
newDateTime = try {
|
||||
newDateTime.withDayOfMonth(currStart.dayOfMonth)
|
||||
} catch (e: Exception) {
|
||||
newDateTime
|
||||
}
|
||||
}
|
||||
return newDateTime
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue