From a8c8d780eb73a629cfb23f870c52c74d1f370bf3 Mon Sep 17 00:00:00 2001 From: joragua Date: Wed, 11 Dec 2024 17:49:30 +0100 Subject: [PATCH] refactor: replace when by if for binary conditions in module `owncloudDomain` --- .../com/owncloud/android/domain/UseCaseResult.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/owncloudDomain/src/main/java/com/owncloud/android/domain/UseCaseResult.kt b/owncloudDomain/src/main/java/com/owncloud/android/domain/UseCaseResult.kt index 3b836ccfe17..575bc6f7b26 100644 --- a/owncloudDomain/src/main/java/com/owncloud/android/domain/UseCaseResult.kt +++ b/owncloudDomain/src/main/java/com/owncloud/android/domain/UseCaseResult.kt @@ -27,14 +27,16 @@ sealed class UseCaseResult { val isError get() = this is Error fun getDataOrNull(): T? = - when (this) { - is Success -> data - else -> null + if (this is Success) { + data + } else { + null } fun getThrowableOrNull(): Throwable? = - when (this) { - is Error -> throwable - else -> null + if (this is Error) { + throwable + } else { + null } }