diff --git a/library/src/main/java/dev/percula/ktx/Enum.kt b/library/src/main/java/dev/percula/ktx/Enum.kt index 21d8022..01505ed 100644 --- a/library/src/main/java/dev/percula/ktx/Enum.kt +++ b/library/src/main/java/dev/percula/ktx/Enum.kt @@ -1,12 +1,12 @@ package dev.percula.ktx /** - * Returns an enum entry with specified name. + * Returns an enum entry with specified name. If the enum has overriden toString(), it will use that */ inline fun > enumSafeValueOf(name: String): T? { return try { enumValueOf(name) } catch (e: Exception) { - null + enumValues().firstOrNull { it.toString() == name } } } \ No newline at end of file