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) {
|
private fun fetchCalDAVCalendarEvents(calendarId: Int, eventTypeId: Long, showToasts: Boolean) {
|
||||||
val importIdsMap = HashMap<String, Event>()
|
val importIdsMap = HashMap<String, Event>()
|
||||||
val fetchedEventIds = ArrayList<String>()
|
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 {
|
existingEvents.forEach {
|
||||||
importIdsMap[it.importId] = it
|
importIdsMap[it.importId] = it
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,11 @@ class Converters {
|
||||||
value
|
value
|
||||||
}
|
}
|
||||||
|
|
||||||
return gson.fromJson(newValue, stringType)
|
return try {
|
||||||
|
gson.fromJson(newValue, stringType)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
ArrayList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
|
|
|
@ -248,7 +248,11 @@ class EventsHelper(val context: Context) {
|
||||||
callback(ArrayList())
|
callback(ArrayList())
|
||||||
return
|
return
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
if (eventId == -1L) {
|
if (eventId == -1L) {
|
||||||
|
|
|
@ -86,7 +86,11 @@ data class Event(
|
||||||
|
|
||||||
while (newDateTime.dayOfMonth().maximumValue < Formatter.getDateTimeFromTS(original.startTS).dayOfMonth().maximumValue) {
|
while (newDateTime.dayOfMonth().maximumValue < Formatter.getDateTimeFromTS(original.startTS).dayOfMonth().maximumValue) {
|
||||||
newDateTime = newDateTime.plusMonths(repeatInterval / MONTH)
|
newDateTime = newDateTime.plusMonths(repeatInterval / MONTH)
|
||||||
newDateTime = newDateTime.withDayOfMonth(currStart.dayOfMonth)
|
newDateTime = try {
|
||||||
|
newDateTime.withDayOfMonth(currStart.dayOfMonth)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
newDateTime
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return newDateTime
|
return newDateTime
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue