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

View file

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