Skip to content

Commit 1e19184

Browse files
committed
Fix crash on score entry when entry is other than number
1 parent 1142fca commit 1e19184

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/kotlin/com/revolgenx/anilib/entry/ui/component/MediaListEntryComponent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fun DoubleCountEditor(
198198
if (it.length > 1) trimStart('0')
199199
}
200200
}.ifBlank { "0" }
201-
val newScore = text.toDouble().let(::getScoreWithInRange)
201+
val newScore = text.toDoubleOrNull()?.let(::getScoreWithInRange) ?: return@TextField
202202
if (newScore == count) {
203203
textFieldValueState = textFieldValue.copy(scoreValue)
204204
} else {
@@ -210,7 +210,7 @@ fun DoubleCountEditor(
210210
textFieldValueState = textFieldValue.copy(text)
211211
} else {
212212
val text = textFieldValue.text.trimStart('0').trim('.').ifBlank { "0" }
213-
val newScore = text.toDouble().let(::getScoreWithInRange)
213+
val newScore = text.toDoubleOrNull()?.let(::getScoreWithInRange) ?: return@TextField
214214
onScoreChange(newScore)
215215
}
216216
},

0 commit comments

Comments
 (0)