Catch ClassCastException

pull/1280/head
Alex Baker 5 years ago
parent 67ef219f4a
commit 6e35cf5ba6

@ -204,9 +204,8 @@ class Preferences @JvmOverloads constructor(
} }
fun getIntegerFromString(keyResource: String?, defaultValue: Int): Int { fun getIntegerFromString(keyResource: String?, defaultValue: Int): Int {
val value = prefs.getString(keyResource, null) ?: return defaultValue
return try { return try {
value.toInt() prefs.getString(keyResource, null)?.toInt() ?: return defaultValue
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e) Timber.e(e)
defaultValue defaultValue

Loading…
Cancel
Save