From abcb51d2a680ac254bba1bc2ff223462fefde649 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 16 Sep 2020 10:44:50 +0200 Subject: Extensions: use more idiomatic kotlin Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/util/Extensions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/src/main') diff --git a/ui/src/main/java/com/wireguard/android/util/Extensions.kt b/ui/src/main/java/com/wireguard/android/util/Extensions.kt index 9106ec77..c8892295 100644 --- a/ui/src/main/java/com/wireguard/android/util/Extensions.kt +++ b/ui/src/main/java/com/wireguard/android/util/Extensions.kt @@ -25,7 +25,7 @@ fun Fragment.requireTargetFragment(): Fragment { } val Preference.activity: SettingsActivity - get() = if (this.context is SettingsActivity) this.context as SettingsActivity else throw IllegalStateException("Failed to resolve SettingsActivity") + get() = context as? SettingsActivity ?: throw IllegalStateException("Failed to resolve SettingsActivity") val Preference.lifecycleScope: CoroutineScope - get() = this.activity.lifecycleScope + get() = activity.lifecycleScope -- cgit v1.2.3