Skip to content

Commit

Permalink
fix: error on getting color or drawable from external map config
Browse files Browse the repository at this point in the history
Call `toString()` instead of unsafe casting to string.
  • Loading branch information
WhiredPlanck committed Apr 25, 2024
1 parent d11dcf8 commit 18f384b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/osfans/trime/data/theme/ColorManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ object ColorManager {
m: Map<String, Any?>,
key: String?,
): Int? {
val value = getColorValue(m[key] as String?)
val value = getColorValue(m[key].toString())
return if (value is Int) value else null
}

Expand All @@ -335,7 +335,7 @@ object ColorManager {
m: Map<String, Any?>,
key: String,
): Drawable? {
val value = getColorValue(m[key] as String?)
val value = getColorValue(m[key].toString())
if (value is Int) {
return GradientDrawable().apply { setColor(value) }
} else if (value is Drawable) {
Expand Down

0 comments on commit 18f384b

Please sign in to comment.