diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-05 00:40:50 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-05 00:40:50 -0500 |
commit | 26bedf4c47d4e918154edf456ee8a74e68a6faf4 (patch) | |
tree | 0fb6d23ee42e2a976af87b27500db54960e6f8ea /app/src/main/kotlin | |
parent | 4c32104d29de32cecf3c9647a8f628bd835e14cf (diff) | |
download | frost-26bedf4c47d4e918154edf456ee8a74e68a6faf4.tar.gz frost-26bedf4c47d4e918154edf456ee8a74e68a6faf4.tar.bz2 frost-26bedf4c47d4e918154edf456ee8a74e68a6faf4.zip |
Wrap parser calls with try catch, resolves #1298
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt | 6 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt | 6 |
2 files changed, 10 insertions, 2 deletions
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<T : Any, Item : IItem<*, *>> : 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 |