From bca24c01986766455565be36a5dcc60cf348af36 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 21 Sep 2020 17:51:35 +0200 Subject: [PATCH] Safe call to awaitCallback --- .../vector/app/features/raw/wellknown/ElementWellKnownExt.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnownExt.kt b/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnownExt.kt index 82f989342e..636a7098e3 100644 --- a/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnownExt.kt +++ b/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnownExt.kt @@ -16,12 +16,13 @@ package im.vector.app.features.raw.wellknown +import org.matrix.android.sdk.api.extensions.tryThis import org.matrix.android.sdk.api.raw.RawService import org.matrix.android.sdk.internal.util.awaitCallback suspend fun RawService.getElementWellknown(userId: String): ElementWellKnown? { - return awaitCallback { getWellknown(userId, it) } - .let { ElementWellKnownMapper.from(it) } + return tryThis { awaitCallback { getWellknown(userId, it) } } + ?.let { ElementWellKnownMapper.from(it) } } fun ElementWellKnown.isE2EByDefault() = elementE2E?.e2eDefault ?: riotE2E?.e2eDefault ?: true