From 617c56cefd9ffcf32e4d6aaf9c79e294d005a753 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 28 Jul 2017 20:13:40 +0200 Subject: [PATCH] make reminder "overrides" field optional at google events --- .../calendar/asynctasks/FetchGoogleEventsTask.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt index 3e3a89b85..1542ca0d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt @@ -190,14 +190,16 @@ class FetchGoogleEventsTask(val context: Context, val googleSyncListener: Google } } - private fun getReminders(json: JsonObject): List { - val array = json.getAsJsonArray(OVERRIDES) - val token = object : TypeToken>() {}.type - val reminders = Gson().fromJson>(array, token) ?: ArrayList(2) + private fun getReminders(json: JsonObject?): List { val reminderMinutes = ArrayList() - for ((method, minutes) in reminders) { - if (method == POPUP) { - reminderMinutes.add(minutes) + if (json?.has(OVERRIDES) == true) { + val array = json.getAsJsonArray(OVERRIDES) + val token = object : TypeToken>() {}.type + val reminders = Gson().fromJson>(array, token) ?: ArrayList(2) + for ((method, minutes) in reminders) { + if (method == POPUP) { + reminderMinutes.add(minutes) + } } } return reminderMinutes