修复偶现的崩溃问题

This commit is contained in:
HapeLee
2025-09-11 02:01:15 +08:00
parent 5f32379543
commit e99157ca8c
2 changed files with 8 additions and 3 deletions
@@ -437,5 +437,10 @@ val Context.bookshelfLayoutGrid: Int
fun Context.themeColor(attr: Int): Int {
val typedValue = TypedValue()
theme.resolveAttribute(attr, typedValue, true)
return ContextCompat.getColor(this, typedValue.resourceId)
return if (typedValue.resourceId != 0) {
ContextCompat.getColor(this, typedValue.resourceId)
} else {
typedValue.data
}
}