From b29ca14afeba19d01fa851746dd23739443f34b1 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sun, 10 Dec 2023 15:08:31 +0530 Subject: [PATCH] Fix crash --- app/src/main/res/layout/app_detail_header.xml | 3 +-- .../src/main/java/com/looker/core/common/extension/Context.kt | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/app_detail_header.xml b/app/src/main/res/layout/app_detail_header.xml index c4f14cb2a..6de90b905 100644 --- a/app/src/main/res/layout/app_detail_header.xml +++ b/app/src/main/res/layout/app_detail_header.xml @@ -167,5 +167,4 @@ app:icon="@drawable/favourite_icon" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - \ No newline at end of file + diff --git a/core/common/src/main/java/com/looker/core/common/extension/Context.kt b/core/common/src/main/java/com/looker/core/common/extension/Context.kt index 6c5495ac7..e2377384f 100644 --- a/core/common/src/main/java/com/looker/core/common/extension/Context.kt +++ b/core/common/src/main/java/com/looker/core/common/extension/Context.kt @@ -71,9 +71,7 @@ private fun Context.getDrawableFromAttr(attrResId: Int): Drawable { } fun Context.getDrawableCompat(@DrawableRes resId: Int = R.drawable.background_border): Drawable = - AppCompatResources.getDrawable(this, resId) ?: throw IllegalStateException( - "Cannot find drawable, ID: $resId" - ) + requireNotNull(AppCompatResources.getDrawable(this, resId)) { "Cannot find drawable, ID: $resId" } fun Context.getColorFromAttr(@AttrRes attrResId: Int): ColorStateList { val typedArray = obtainStyledAttributes(intArrayOf(attrResId))