`toModel` was not catching com.squareup.moshi.JsonDataException properly (discovered when joining a Jitsi conf added as a Widget)

This commit is contained in:
Benoit Marty 2022-11-17 12:28:58 +01:00
parent 33b7294bbf
commit 5d3228d97b
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ inline fun <reified T> Content?.toModel(catchError: Boolean = true): T? {
val moshiAdapter = moshi.adapter(T::class.java) val moshiAdapter = moshi.adapter(T::class.java)
return try { return try {
moshiAdapter.fromJsonValue(this) moshiAdapter.fromJsonValue(this)
} catch (e: Exception) { } catch (e: Throwable) {
if (catchError) { if (catchError) {
Timber.e(e, "To model failed : $e") Timber.e(e, "To model failed : $e")
null null