From 26bedf4c47d4e918154edf456ee8a74e68a6faf4 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 5 Jan 2019 00:40:50 -0500 Subject: Wrap parser calls with try catch, resolves #1298 --- .../kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt | 6 +++++- .../kotlin/com/pitchedapps/frost/services/FrostNotifications.kt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt index 00d04a3e..9f26f3f7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt @@ -129,7 +129,11 @@ abstract class FrostParserFragment> : RecyclerFragme val cookie = FbCookie.webCookie val doc = getDoc(cookie) progress(60) - val response = parser.parse(cookie, doc) + val response = try { + parser.parse(cookie, doc) + } catch (ignored: Exception) { + null + } if (response == null) { L.i { "RecyclerFragment failed for ${baseEnum.name}" } L._d { "Cookie used: $cookie" } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt index d036d3a8..f66f77e2 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt @@ -117,7 +117,11 @@ enum class NotificationType( * or -1 if an error occurred */ fun fetch(context: Context, data: CookieModel): Int { - val response = parser.parse(data.cookie) + val response = try { + parser.parse(data.cookie) + } catch (ignored: Exception) { + null + } if (response == null) { L.v { "$name notification data not found" } return -1 -- cgit v1.2.3